Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Heighest frequencyletter in the input string

Home > Programs > Strings

205 / 59

Return the character which occurs for the maximum numbers of times in the Input String.
If multiple characters occur with the same highest frequency then return "0".

Answer:

#include 
using namespace std;
 
int main()
{
    string s;
    cin>>s;
    int n = s.length();
    int hash[26]={0};
    int count=0,ans=-1,in=-1;
    for(auto i:s)
    {
             hash[i-'a']  ;
    }
    for(int i=0;i

Asked In :: TCS NQT Nagarro Wipro NLTH HackerRank

Post Your Answer Here:

Language:

Post Your Reply Here: