I see that the problem appears after a level is increased, but I don't know the reason. In my version I have a sum var, which is the sum of the values in the array (I'm adding new values in the for cycle where I compute the points). If the sum is greater than or equal to ten, I subtract ten from it and increase the level variable by one.
i am running the random tests while attempting to submit my code and it seems that the math in the tests is not correct. I am testing Python solution.
For example i have got the following message after running my code:
Failed when arr = [1, 4, 1, 4, 1, 4, 1, 1, 2, 0, 0, 4, 2, 3, 3, 3, 3, 4, 0, 0, 1, 2, 1, 0, 1, 2]: 18180 should equal 18620
well. let's see:
level 0: 1,4,1,4: 40+1200+40+1200 = 2480
level 1: 1,4,1,1,2,0,0,4: 80 + 2400+80+80+200+0+0+2400 = 5240
level 2: 2,3,3,3 : 300+900+900+900 = 3000
level 3: 3,4,0,0,1,2: 1200 + 4800 + 0 + 0 + 160+400 = 6560
level 4: 1,0,1,2: 200+ 0 + 200 +500 = 900
score = 2480+5240+3000+6560+900 = 18180
some of the tests are passed and some of them are incorrect as the one above. could you please check if I am missing something or the test case is really incorrect?
I don’t see your code, so I can’t say what’s wrong. But if you provide an example, then I can describe it in details.
The most common mistakes:
I see that the problem appears after a level is increased, but I don't know the reason. In my version I have a sum var, which is the sum of the values in the array (I'm adding new values in the for cycle where I compute the points). If the sum is greater than or equal to ten, I subtract ten from it and increase the level variable by one.
thank you all very much! got it.
If no one checks earlier, then I will try to look at the weekend.
Thank you for your contribution!
Thank you warriors!
Follow the example and find the mistake by yourself. Write, please, if it doesn’t help.
for input
[2, 0, 2, 4, 4, 0, 4, 3, 0, 0, 0, 1, 0, 0, 2, 4, 0, 1, 3, 4, 2, 0, 2, 1, 4, 2, 0, 0, 1, 3, 1, 4, 4]
Try to figure it out yourself with an example:
for input
[2, 0, 4, 2, 2, 3, 0, 0, 3, 3]
correct
your
You need to fix a little your calculation.
Not a kata issue, your code is wrong, use Question label for that. You're handling levels wrong, check again the kata description.
That.
Not a kata issue.
i am running the random tests while attempting to submit my code and it seems that the math in the tests is not correct. I am testing Python solution.
For example i have got the following message after running my code:
Failed when arr = [1, 4, 1, 4, 1, 4, 1, 1, 2, 0, 0, 4, 2, 3, 3, 3, 3, 4, 0, 0, 1, 2, 1, 0, 1, 2]: 18180 should equal 18620
well. let's see:
level 0: 1,4,1,4: 40+1200+40+1200 = 2480
level 1: 1,4,1,1,2,0,0,4: 80 + 2400+80+80+200+0+0+2400 = 5240
level 2: 2,3,3,3 : 300+900+900+900 = 3000
level 3: 3,4,0,0,1,2: 1200 + 4800 + 0 + 0 + 160+400 = 6560
level 4: 1,0,1,2: 200+ 0 + 200 +500 = 900
score = 2480+5240+3000+6560+900 = 18180
some of the tests are passed and some of them are incorrect as the one above. could you please check if I am missing something or the test case is really incorrect?