#3663
Find The Least Frequent Digit
easy · 69.7% accepted · 45 likes · top 78%
array · hash table · math · counting
Description
Given an integer n, find the digit that occurs least frequently in its decimal representation. If multiple digits have the same frequency, choose the smallest digit.
Return the chosen digit as an integer.
The frequency of a digit x is the number of times it appears in the decimal representation of n.
Solution