Question d’entretien chez Cognizant

write a program to find a character with maximum appearance in a String

Réponse à la question d'entretien

Utilisateur anonyme

18 avr. 2022

// Java program to output the maximum occurring character // in a string public class GFG { static final int ASCII_SIZE = 256; static char getMaxOccurringChar(String str) { // Create array to keep the count of individual // characters and initialize the array as 0 int count[] = new int[ASCII_SIZE]; // Construct character count array from the input // string. int len = str.length(); for (int i=0; i