Hacker News new | ask | show | jobs
by vogr 509 days ago
> I've got a hard time imagining they were going for a solution other than you adjusting the base.

I agree that this is probably what they were going for, but it still seems a bit ridiculous that the conversion from numbers to the chosen representation is not subject to the same rules (i.e., you can call `.toString(15)`, and this definitely uses numbers under the hood!). If this is allowed, then you could also encode your numbers as the string "{n % 3}{n % 5}" and be done with it. Or if they wanted a unique encoding, "{n}{n % 3}{n % 5}" would work too!

1 comments

The toString wasn't used in the solution. It was used in creating the solution. Encoding the numbers as your given string exceeds the max length of an encoded character per the rules.