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.
what do you mean by this? url.indexOf(p1 + '=') < qPos
This comment is hidden because it contains spoiler information about the solution
One or more characters that aren't a question mark or an equals sign.
Could someone explain what [^?=]+ does in this regex?
The regex doesn't work if paramatres are set to more than one character.
E.g.
stripUrlParams('www.codewars.com?a=12&a=34');
This should work:
/&?([^?=]+)=[^&]+/g
Done: users are going for very bad and inefficient approaches, it has nothing to do with the test code. I would gladly implement something to deal with it, but right now CW is refusing to save any edit to the kata.
You are evidentely modifying the array in place, which is bad practice unless required.
Also, I see no part of the description forbidding the use of negatives, but I can quickly fix that (and it has nothing to do with the problem).
Actually I fear your code was faulty, needlessly modifying the array in place. Fixed that, so that even not so efficient and bad practice solutions might work.
Actually modifying the array is considered bad practice if unnecessary.
Btw, I upvoted myjinxin2015, as he definitely deserved it.
Hi myjinxin2015 ! I modified my code following your advice and it worked.
I imagine approximately why the random tests failed, interesting anyway :)
Thanks !
Giacomo, could you please address the issue above?
This kata is not supposed to be passing negative values. Let me look into this.
I can't edit the test cases right now. Can someone provide access to edit my Kata pls? :p In the meantime, I've gone and changed the title and description to match the test cases.
myjinxin2015: even though I think it's not correct approach and evaluation of tests should be independent of the modification to the original array (it still returns correct sum, doesn't it? and why it works with initial tests but not random?) you're right that it helps to pass the random tests. Once I changed code the way it works with copy of original array it works fine.
Anyway, you are not sensei of this kata and thanks for advice
I just said some advice, if you don't agree you can ignore it.
But why did I get a
downvote
? Unhappy :(Loading more items...