CommonDigits
SRM 128 · 2003-01-06 · by vorthys
SRM 128 · 2003-01-06 · by vorthys
Problem Statement
Problem Statement
Create a class CommonDigits with a method digit that takes an
Constraints
- num is between 1 and 1000000000, inclusive.
Examples
0)
123 Returns: 1
All digits occur the same number of times so return the leftmost.
1)
102030 Returns: 0
2)
79888799 Returns: 9
3)
1 Returns: 1
4)
1000000000 Returns: 0
Submissions are judged against all 31 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class CommonDigits with a public method int digit(int num) · 31 test cases · 2 s / 256 MB per case