题目描述
Given a number N, find the most occurring digit in it. If two or more digits occur same number of times, then return the highest of them. Input number is given as a string.
Example 1:
Input:
N = "12234"
Output:
2
Explanation :
2 occurs most times
Example 2:
Input:
N = "1122"
Output:
2
Explanation :
1 and 2 occurs most times but 2 > 1.
Your Task:
You don't need to read input or print anything. Your task is to complete the function solve() that receives a string N as input parameter and returns the most frequent digit in it as a string.
Expected Time Complexity : O(len(N))
Expected Space Complexity : O(1)
Constraints:
1<= len(N) <=101000
输入格式
见题面
输出格式
见题面
样例输入
N = "12234"
样例输出
2