Skip to main content
3 of 5
added 78 characters in body
Mayube
  • 11.7k
  • 2
  • 48
  • 93

Find the highest unique digit

Surprisingly we haven't had a simple "find the highest digit" challenge yet, but I think that's a little too trivial.

Given input of a non-negative integer, return the highest unique (ie not repeated) digit found in the integer. If there are no unique digits, your program can do anything (undefined behaviour).

The input can be taken as a single integer, a string, or a list of digits.

##Test cases

12         -> 2
0          -> 0
485902     -> 9
495902     -> 5
999999     -> Anything
999099     -> 0
1948710498 -> 7

This is so fewest bytes in each language wins!

Mayube
  • 11.7k
  • 2
  • 48
  • 93