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 firstname.lastname@example.org. 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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Count distinct pairs from two arrays having same sum of digits
- Find Next number having distinct digits from the given number N
- Print all numbers less than N with at-most 2 unique digits
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Minimum digits to be removed to make either all digits or alternating digits same
- Number of distinct ways to represent a number as sum of K unique primes
- Count subsets having distinct even numbers
- Length of longest subarray having only K distinct Prime Numbers
- Count of N-digit numbers with all distinct digits
- Count numbers with exactly K non-zero digits and distinct odd digit sum
- Count of distinct numbers formed by shuffling the digits of a large number N
- Divide the array into minimum number of sub-arrays having unique elements
- Subsequence pair from given Array having all unique and all same elements respectively
- Largest Sum Contiguous Subarray having unique elements
- Count of unique digits in a given number N
- Count numbers formed by given two digit with sum having given digits
- Find the count of numbers that can be formed using digits 3, 4 only and having length at max N.
- Print all numbers in given range having digits in strictly increasing order