I am writing a program which has an output requirement for the number printed to not have a repeated integer in it
i.e. it would not print 122, 161, 998, etc
but it would print any other number such as 123, 345, 742..etc
how do i go about doing this? thanks!
A C-language compatible solution would be to convert the number to a string and keep a frequency count of the digits and return true if there are duplicates, e.g.:
[Edit] You can also save a few bytes (and possibly some time) by using a bitset instead of an int array. For example: