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.
Clever, but this code is less readable than if you split it into several functions with explicit names.
Don't use too many loops, and make sure they are as simple as possible. Also, a change of approach maybe? You would've solved a 5kyu without performance measures, just know that.
Yes, if you click attempt, I can see your current solution so far.
Oh, thanks. I will try to optimize code.
And... I'm sorry. I am new to the codewars. Just would like to know.
You can see my unpublished code for this task, right?
Your code is similar to bubble sort. Bubble sort is one of the slowest sorting algorithms, so no surprise that your code is very slow. Try using less for loops and ecspecially not switching each one.
All I do is just sequentially look for pieces. But still my code is too slow. Can you inspirate me by any ideas?
Yes. A for loop inside a for loop inside of another for loop is way too slow. You have to get rid of that. One for loop with no for loops inside will be fine, if you know what you're doing. You can even have multiple. You may have a for loop in another for loop if its really simple, and everything is simplified enough.
My code runs for just over a second (1.2) in sublime with one of the larger tests. It gets the right answer but it wont pass the Kata tests. I have no idea how to optimize it. I probably need another approach.