Cody

Problem 2139. most frequent character

Solution 2230062

Submitted on 23 Apr 2020 by Ashin Kuriakose
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 'purusa'; y_correct = 'u'; assert(isequal(frequent_character(x),y_correct))

c = 112 117 114 117 115 97 y = 'u'

2   Pass
x = 'rama'; y_correct = 'a'; assert(isequal(frequent_character(x),y_correct))

c = 114 97 109 97 y = 'a'

3   Pass
x = 'extemporaneous'; y_correct = 'e'; assert(isequal(frequent_character(x),y_correct))

c = 101 120 116 101 109 112 111 114 97 110 101 111 117 115 y = 'e'

4   Pass
x = 'Thisisasentencewrittenasalongwordwithnospaces.'; y_correct = 's'; assert(isequal(frequent_character(x),y_correct))

c = Columns 1 through 30 84 104 105 115 105 115 97 115 101 110 116 101 110 99 101 119 114 105 116 116 101 110 97 115 97 108 111 110 103 119 Columns 31 through 46 111 114 100 119 105 116 104 110 111 115 112 97 99 101 115 46 y = 's'

5   Pass
x = 'Jabberwocky'; y_correct = 'b'; assert(isequal(frequent_character(x),y_correct))

c = 74 97 98 98 101 114 119 111 99 107 121 y = 'b'

6   Pass
x = 'inimical'; y_correct = 'i'; assert(isequal(frequent_character(x),y_correct))

c = 105 110 105 109 105 99 97 108 y = 'i'

7   Pass
x = 'nine-million'; y_correct = 'i'; assert(isequal(frequent_character(x),y_correct))

c = 110 105 110 101 45 109 105 108 108 105 111 110 y = 'i'