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.
- Print all numbers less than N with at-most 2 unique digits
- Count of N-digit numbers with all distinct digits
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- 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
- Count distinct pairs from two arrays having same sum of digits
- Check if the sum of distinct digits of two integers are equal
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- 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
- Maximum sum of distinct numbers with LCM as N
- Smallest subarray with k distinct numbers
- Exactly n distinct prime factor numbers from a to b