r/programming • • May 09 '15

"Real programmers can do these problems easily"; author posts invalid solution to #4

https://blog.svpino.com/2015/05/08/solution-to-problem-4
3.1k Upvotes

1.3k comments sorted by

View all comments

3

u/MikeSz May 09 '15

good fun doing the exercises. only number 4 gave me trouble - brute forced it with the permutations library, so there is probably a better way.

3

u/hpp3 May 09 '15

Sort the numbers in reverse, as strings. You need to also pad all the strings to be the same length in order to compare, by repeating the string until it's the right length. E.g. 123 padded to 7 digits would be 1231231.

→ More replies (18)