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.
Generally if you run into issues like that it means it's not about "optimizing" your solution but actually starting from scratch and finding a different approach that works. The correct solution to this kata solves it in a fraction of a second. Basically you need to rethink your approach. I can't say more or it would be a spoiler.
Quite often with the harder katas it's not really matter of "optimization" as such (making your algorithm run faster), but instead of finding a completely different approach that is faster.
The advice above is solid. If you are new to coding you probably shouldn't be doing 4 kyu katas. Start at easier ones and then climb from there.
So I was testing why my solution was timing out (can't honestly imagine how to make it faster) and I made it return just 0 and one of the advanced cases passed.
Is there really a case that requires 0 (wouldn't really make sense, per the description there is no way to make a case where 0 is correct result) or is this just some timer case that checks if you fit in the 1 second?
You have the code misaligned
Try looking at it again like this. I don't think I can explain much more without it counting as a spoiler. (remember ^ is "start going up" not "go up one space")