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.
You can use
console.log
to print the data to stdout.Hello.. I need help, bcos after my stupidly simple and naive solution with normal sort, which closely didnt make it through timeout,
I came up with another algo, which passes fine first suits of tests (in about 200ms for second part with timeout). Everything looking great, but when performing attempt,
it fails on random tests but I cant see why and what set of data were used.. Im getting wrong counts of gems, weird...
The reference solution is correct BTW. I brute forced it in https://www.codewars.com/kumite/670be7418cec2e9e1c4ea945
and you should, this is a 4 kyu after all
ofc, you can change the tests if that's needed.
That's not intended but I guess I can't do anything with it 😂
My solution is faster than that, so I guess I can further raise
n
or make timer stricter.But probably not after this kata being approved.
I figured out what the issue was (to do with large negative number arithmetic) and have fixed it and submitted my final correct solution. Removal of the incorrect one would be appreciated if possible.
If there's a way of removing the solution it shouldn't stay because it isn't a correct solution. As I mentioned, it fails about 5% of the time. It's also unfinalised and has multiple things I would tidy up before properly submitting.
Your solution will stay. Those solutions were not intended.
This comment is hidden because it contains spoiler information about the solution
You should probably specify the input range, like, how big the string can be.
I don't want to start trying to come up with a fancy solution if brute force works.
oops, I .slice() in the wrong way
"0" is not a valid input. It's not positive.
Fixed
Loading more items...