Given a range, print all numbers having unique digits.
Input : 10 20 Output : 10 12 13 14 15 16 17 18 19 20 (Except 11) Input : 1 10 Output : 1 2 3 4 5 6 7 8 9 10
As the problem is pretty simple, the only thing to be done is :- 1- Find the digits one by one and keep marking visited digits. 2- If all digits occurs one time only then print that number. 3- Else not.
1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20
This article is contributed by Sahil Chhabra. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Print all numbers less than N with at-most 2 unique digits
- Count of N-digit numbers with all distinct digits
- Count numbers with exactly K non-zero digits and distinct odd digit sum
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Next Number with distinct digits
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- Check if the sum of distinct digits of two integers are equal
- Count distinct pairs from two arrays having same sum of digits
- Number of distinct ways to represent a number as sum of K unique primes
- Numbers less than N which are product of exactly two distinct prime numbers
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Count unique numbers that can be generated from N by adding one and removing trailing zeros
- Find ways an Integer can be expressed as sum of n-th power of unique natural numbers