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.
Priority goes to the Power Gem with higher elevation, so in your example the first case would be the correct result.
So after reading all of the other questions, and not really finding an answer to the one I had, I thought I'd ask it
In the context of Power Gems
What would the power gem look like in the following situation
if the formed power gems look like
1's and 2's being the power gem id and the S's being single.
The explanation of the game mentioned how when power gems are formed, the higher elevation takes priority, and when a gem wants to 'grow' it tries to form a new power gem and then combine with others at the same level, but what if the gems are already formed, and there are 2 options for 'growing'?
Would the formation of power gems look like
or
assuming they are the same color
Damn, now thats some optimization.
I picked the closest solution I had - mine. In fact, I improved my old and bad algorithm and managed to get a
2x
increase in execution speed (tested with the same input as in the previous fork).Ahh, I hadn't seen your solution, I was just looking at the ones that were rated best solution. But I knew my solution wouldnt have been BEST, but I'm glad to see your solution, hopefully it will help me with optimizing in the furute!
Not really. Tested on greater input values, your solution is degrading faster (press
View Run Output
, and you should see 2 collapsed blocks; open them and you'll see the execution time).What language are you using?
I think they use 0 and . in the description because its easier to read, but the code works the same.
I think the reason for 0's and 1's are for the boolean true and false comparison someone could use in their code.
I mean, it still works, I got mine down to 651 ms.
Looking at the other solutions, mine seems to be faster than others.
Normally I'm struggling to make it in the time limit, I'm terrible at optimizing.
This was my first code to run faster than the other people I've looked at!
yes, the performance tests were completely wrong..... I corrected them, your solution should be marked as invalid soon.
This comment is hidden because it contains spoiler information about the solution