TheBeauty
SRM 437 · 2009-03-24 · by Vasyl[alphacom]
SRM 437 · 2009-03-24 · by Vasyl[alphacom] · Simulation
Problem Statement
Problem Statement
There is nothing more beautiful than just an integer number.
The beauty of an integer is the number of distinct digits it contains in decimal notation.
You are given an integer number n. Return the beauty of this number.
Constraints
- n will be between 1 and 1,000,000,000, inclusive.
Examples
0)
7 Returns: 1
Just one digit.
1)
100 Returns: 2
Two distinct digits - 0 and 1.
2)
123456789 Returns: 9
All the digits are different.
3)
1000000000 Returns: 2
4)
1 Returns: 1
Submissions are judged against all 21 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class TheBeauty with a public method int find(int n) · 21 test cases · 2 s / 256 MB per case