Better first filter, then sort.
I hope it will be OK :-)
It took me almost a month working on this one of and on, I would say it is more than 5 kyu haha. But i learned a lot.
This one was very fun! I tried very hard to get my regex to match all cases and then to refactor it, but when I finally saw other solutions I realized I have a lot more to learn, lol.
fixed initial code
the function name in the initial code is still to_PTR
Duplicate as noted below. And the addition of some trivial string operations doesn't change anything.
Thanks! I updated the Kata to follow Python convention :)
Hi! I had seen that Kata, but I think the addition of string manipulation at the end made it different enough.
Looks like a duplicate. It's the same as the following kata, except appending a string for valid cases: https://www.codewars.com/kata/515decfd9dcfc23bb6000006
My first solution took 30 seconds for $n = 1200, but bit by bit I managed to improve to get $n = 4000 near 100ms and that was enough, phew.
Very nice kata, I learned a lot!!