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.
This is way older than ChatGPT, probably it was in its learning database.
This comment is hidden because it contains spoiler information about the solution
I haven't been here for a while, but the point was exactly some clever code at least back then. I wonder if that shifted, or simply new people came.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It's linear, so it scales ok. Sure it's not optimized for very different lengths case, but optimized != best practice.
Best practice is right compromise between optimization and code clarity.
You should really look into regular expressions more:
Don't need a
list
around str. Strings are iterable.Don't need to create a list, just:
This was my initial solution in python, but I feel that tracking both left and right is clearer.
NaN
propagation trick is fucking neat.You don't need to store all the sums, you can update them on the fly - http://www.codewars.com/kata/reviews/54d9d8b15ca355f10100018c/groups/54ea9c0e87ed7fc0c9000a6e
This has quadratic complexity while linear is possible.
Use
.each.with_index
?This has quadratic complexity while linear is possible http://www.codewars.com/kata/reviews/54d3c3bec7f9887be600019c/groups/54ea9933bc1a2557180001c7
Loading more items...