Inspired by the fact that 2013 is the first year since 1987 which has four unique digits, what's your best code to determine the number of unique digits in a number?
Here's what I ended up with, skipping the %unique method:
$y = 2013; ($y = join('',sort(split(//,$y)))) =~ tr/0-9//s; print "unique digits: " . length($y) . $/;
I'm sure there's something smarter.
In reply to Golf for unique digits by Cody Fendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |