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.
still applies...
This issue no longer applies.
Why did you marked this as Spoiler? It's really a nice suggestion.
I don't know without benchmarking, but my bet would be on concat being faster as it uses less resources still creating a new array like JSON.parse does.
That is true. But sometimes I squeeze out the very last resource of what Codewars allows me to use to test performance and having to clone a 2+ million array 50 times takes away from the 6 second limit. For katas like this I will remember that in the future. I used JSON.parse(JSON.stringify(arr)) in this case, do you know without having to benchmark it if that is significantly slower than [].concat?
You don't have to necessarily put that into the description.
Just use something like
[].concat(*yourtestarray*)
as a parameter for the first function in your test cases, as it basically clones it ;)Note to self for future katas: Add to description that original arrays shouldn't get modified and then add test cases to check that.
All good now, try and resubmit your solution. Thanks for bringing this to my attention!
I've added this to the description. Thanks!
thank you for your feedback. I fixed those issues, The Kata will work better. Please try it again
Specifically, the author of the test used some bit manipulation to round, when he/she should have used Math.floor. The bit stuff only works with 32-bit integers. I myself submitted a solution with the same bug just to get the tests passing.
Thank you. Used it on a project calling modbus commands.
How did you find the solution with not checking the last 5 bits because of inaccuracy?
This comment is hidden because it contains spoiler information about the solution
Thanks for this! I added it to both versions.
I tested this example with your code and it doesn't pass the test. I also tested it with my code and it fails at the moment when it's testing the boxes (it does pass the 2 other validattions) - Please give it another try.
This comment is hidden because it contains spoiler information about the solution
I'm glad to hear it!