# Determine if all decimal digits are unique

Deleted questions on Stack Overflow sometimes make for great golf material.

Write a function that takes a nonnegative integer as input, and returns true if all the digits in the base 10 representation of that number are unique. Example:

48778584 -> false
17308459 -> true


Character count includes only the function.

If you choose to answer in C or C++: no macros, no undefined behaviour; implementation-defined behaviour and compiler warnings are fine.

• I'd still be interested in other C or C++ solutions as per the question that inspired this one. May 21, 2014 at 19:59
• Why no C or C++ macros or undefined behavior? That's oddly limiting to just two languages. Apr 14, 2019 at 2:05

# convey, 355 bytes

          1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}  1-}
>>vv<">>~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;~>>?;}
^ ;<1@>]3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!3 >>!
,{>">"   >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0 >#v0
.10|>#>>"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#"@^>#]
_<<<<%10>=0 1>=1 1>=2 1>=3 1>=4 1>=5 1>=6 1>=7 1>=8 1>=9 1


Try it online!

I don't believe that this was the more optimal solution in convey, but it's cool to see it running at least (You can watch all the process in the "Try it online" link):

# Perl, 63ish

$echo 48778584| perl -F// -alpe '$"="";$_= 0<"@{[map {$a{$_}++} @F]}"?"false":"true"' false$ echo 17308459| perl -F// -alpe '$"="";$_= 0<"@{[map {$a{$_}++} @F]}"?"false":"true"'
true