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.
Approved
C++ translation (author is inactive).
Thanks for the answer! I will keep this in mind in the future. Figured it out.
As I said, without knowing your code, it is difficult to tell. There can be so many possible causes, that to know for sure, I would have to run your solution, and see how tests behave. There is really, really many things which can go wrong, and in languages like C or C++ your solution can even make error messages wrong. And we do not even know the language, so we have absolutely zero idea what to check. If you give us your code, we will know the broken language, and we will be able to run broken tests, see why they fail, and tell you how to fix your broken solution.
Could it be, you're mutating the input?
@hobovsky, but 6, 4, 6, 6, 4 is not going to be 400 in any way.
Three 6 is 600.
Why was he expecting 400?
My guess is, you're using a global var and it keeps the previous vale.
How can we know? :) We cannot tell without knowing your code.
what's the problem, why is he expecting an incorrect answer?
Incorrect answer for dice=[6, 4, 6, 6, 4]
Expected: 400
Submitted: 1000
my ide return: 600
It depends on what would be your exact idea, but sliding window does not sound like a right solution. For example, for
[2, 2, 2, 2, 3]
you will get two triplets of2
.Is it solvable with sliding window ? My idea was to use windows size of 3 and then check for triplets in the window and check the number to add to the result. Any hints ?
.
@big_M Thank you so much for your suggestions!
read the codewars rules on the link given by hobovsky
This is because your code has a bug and it fails when run more than once. It is not a kata issue.
Loading more items...