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 comment is hidden because it contains spoiler information about the solution
This is a very good piece of code. Way more efficient and readable than mine. Congratulations! I will take the opportunity to learn some tricks from your code :)
This comment is hidden because it contains spoiler information about the solution
Since you fail the random tests I strongly suppose that you modify the given input (for example you reverse it in place) and so the reference solution for the random tests doesn't work on the "good" array. Work on a copy of the given input. Cheers.
Question resolved...
Given almost all posts about getting timeout are marked as having spoilers because they have, and the same answers are repeated over and over, read this if that's your case:
Your code's time complexity is O(n2) and that won't work here. You code's time complexity should be O(n) to pass. Try googling
"Big O notation"
(it's a long subject to explain it here properly), your code should work in linear time, so if your code use nested loops or a loop and a loop-alike method inside try another way.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'm having issues with the large array tests in Powershell. The test case and my code always arrive at the same final sum (value at index 0 in the result) but my results differ from the expected results by a small amount in every other value. I also end up with a shorter array by 2.
As an example, the first 3 expected totals from a random test are 0, 5, 24 and my results are 0, 4, 14 yet we both end up with a final total of 8398.
I output the array passed in and manually worked out the first few results. The results calculated manually match what my algorithm is calculating but do not match the expected results. Example from a random test:
First few values: 16 16 18 14
Expected results: 0 12 33 38
My calculated results: 0 16 32 50
I don't see how the expected results are getting calculated.
let's try this one:
your code says (twice) if i[2] == "Y": etc...
but... some cards would be at i[3], because the player's number has 2 digits
so a card such as "A11Y" - you would consider it as red...
hope it does it - close the question if it does :-)
This comment is hidden because it contains spoiler information about the solution
You forgot the 0
Yes, I understand now. Thank you for the clarification!
It seems so, I guess to insert like that, you have to move all the other elements in the list internally. Read this
This comment is hidden because it contains spoiler information about the solution
Loading more items...