Return maximum occurring character in the input string Write an efficient C function to return maximum occurring character in the input string e.g., if input string is “test string” then function should return ‘t’. Algorithm: Input string = “test” 1: Construct character count array from the input string. count['e'] = 1 count['s'] = 1 count['t'] = 2 2: Return the index of maximum value in count array (returns ‘t’). Implementation: #include
Read full article from Return maximum occurring character in the input string | GeeksforGeeks
No comments:
Post a Comment