×

# REPUB - Editorial

Author: Ranjan Kumar Singh
Tester: Ved Prakash
Editorialist: Sudipto Roy

CAKEWALK

Arrays

# PROBLEM:

To find the alphabet with the heighest frequency.

# EXPLANATION:

For the given string, first check if the string has capital alphabet or small alphabet. Increment the frequency array according to what alphabet is found.

Pseudo Code:

for i=1 to 26:
count[i]=0    //counting frequency
for i=1 to l(length of string):
if(str[i] is lower alphabet) count[str[i]-'a']++;
else if(str[i] is capital alphabet) count[str[i]-'A']++;   //selecting heighest frequency
max_freq=0
for i=1 to 26:
if(count[i]>=max_freq) max=count[i],index=i


Complexity: O(N).

# SOLUTIONS:

1037
accept rate: 15%

1.1k313

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,852
×1,688
×15

question asked: 05 Feb '15, 00:10

question was seen: 407 times

last updated: 05 Feb '15, 12:41