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.
That doesn't sound unreasonable.
Sample tests added.
Have a closer look at your array bounds and what elements in the array you access on each loop.
You are most welcome. Good luck to you too.
Why would you think that?
Copy of array now passed in to functions.
In your code you do
arr.shift()
which mutates the array being passed in.I should have been guarding against that and passing in a frozen or cloned array, fixed in JS now.
Now it's in TypeScript as well. Are you not entertained?
Makes sense, I've removed the test passing in string numbers.
Think it's time I added a TypeScript translation of this Kata.
This comment is hidden because it contains spoiler information about the solution
Hi, the tests are expecting javascript objects with no prototype. In your case, your objects have the Obj prototype. You could create the output objects using the litteral object syntax or use Object.assign/spread operator to copy your Obj properties into a basic literal object.
Thanks, I've fixed the test code to remove the warning aboout 'i' being unused that was causing confusion.
The error below it is a problem with your code though.
Cool cheers, what was the change you made and is it live? I'm having trouble tracking the changes with the Codewars revision system.
This comment is hidden because it contains spoiler information about the solution
I assume you are attempting the C translation?
This means that your code fails one of the random tests, though I'll admit the output here is far from clear.
The random tests generate a semi-random series of numbers and then call your funtion and a reference function that is known to be correct (a reference function). It then compares the output from your function with the output of the correct function and checks they are correct. In your case the outputs are different so the test fails.
I'll take a look to seee if I can make the output easier to understand.
I've had a closer look. The random tests don't actually test anything as
numbers.size()
always returns0
since writing past the end ofthe vector doesn't cause it to grow.Also, you are just testing the true/false aspect and not what the first non-consecutive number found was.
Loading more items...