Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
'Best Practices' and 'Clever' are nice ways to flag a solution but there should be a 'Bad Practice' flag too.
So many bad solutions (unreadble but short) get 'Best practice' flags and it's very missleading to anyone trying to learn from other peoples code. Negative flags would help counter this problem but might need a trial just incase we're all secretly trolls.
I think this is too easy for a 4 kyu can it be made a 5 kyu?
I like how you overwrite node.next attribute while looping. +1 Clever.
I think this is a bit easy for a 6 Kyu.
Nice use of formatting and each_with_object. +1 Best Practice.
You are totally correct, This is not best practice at all! If someone put this in production code I would have them fired unless they refectored it immediately.
This is nice short code but it's not performant. The spec said clearly that the number could be as long as 1000 characters so this code is highly inefficient.
Using just a 145 char input:
'8796124949812349867123476123861036743081267246891823601824612380182479182370641298367104287614391340128437678236298348731048461735109841091212442'
This solution solves it in
223.375ms
, whereas my solution took only24.632ms
. Mine is far from perfect but it shows how much of a difference the performance makes. People should try to remember that this isn't code golf, we should aim for production ready code and maybe even include a benchmark in the spec!In any base 0 is 0, and if im not mistaken that's a palidrome. Since programmers tend to count from 0 I think it should be included in the output and tests. It was confusing to have to explicitly exclude it.
Just in case you don't know, you realy shouldn't be nesting ternary operators within each other. It's not best practice and this isn't code golf ;)