You are given a non-negative integer n. Your task is to return the digit that appears most frequently in the number.
If multiple digits have the same highest frequency, return the smallest digit among them.
Input: n = 1122234
Output: 2
Explanation: The digit 2 appears three times, more frequently than any other digit.
Input: n = 1213141
Output: 1
Explanation: The digit 1 appears four times, making it the most frequent digit.
Input: n = 1234
Output: 1
Explanation: All digits appear once, so the smallest digit, 1, is returned.
Sign in to write, run, and submit your solution against the full test suite.