You are given a non-negative integer n. Your task is to determine whether all its digits are distinct.
If every digit appears exactly once, return Yes. If any digit appears more than once, return No.
Input: n = 1234
Output: Yes
Explanation: Every digit appears exactly once, so all digits are distinct.
Input: n = 1223
Output: No
Explanation: The digit 2 appears twice, so the digits are not all distinct.
Input: n = 7
Output: Yes
Explanation: A single-digit number has no repeated digits, so all its digits are distinct.
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.