You are given an integer n. Consider how many times each digit (0 through 9) appears in its decimal form.
Your task is to identify the digit that appears the least number of times.
If more than one digit has the same lowest frequency, select the smallest digit among them.
Return this digit.
Input: n = 808080
Output: 8
Explanation:
Digits: 8 → appears 3 times 0 → appears 3 times Both have frequency 3, so pick the smallest → 8.
Input: n = 444123
Output: 1
Explanation:
Digit frequencies: 4 → 3 times 1 → 1 time 2 → 1 time 3 → 1 time The smallest digit among those with lowest frequency is 1.
Accepted:
Submission: