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.
The number of results for
n
is ( on the order of )n^2
- in that sense, you're just not going to find anO(n)
solution.In terms of requested number of results, it can be done in
O(n)
. You can't be calculatingn over k
for every result to do that, but following the description works.If iterating over
n
items inO(1)
time were possible, solving P problems would be a lot faster.I'm curious too.
@Chrono79
.sort
Is not stable in Node v8 and v10, but it's stable in Node 12 and up. Now it's a kata problem for not enabling Node v12.arr.length is a property of Array.prototype and the kata prohibited Array.prototype methods. And I agree with you, so many solutions are using temp array, the worse is that they are marked as clever...
I have solved it and got all testcases passed but not satisfied, in the sense that can it be done in linear time ?, like using two loops leads to O(n ^ 2). Can anyone please suggest the way or algorithm.
In solutions people use arr.length(which is part of Array.prototype) and also in description it was nowhere mentioned about replace is prohibited. Also clearly mentioned no temp array but in many solutions I can see temproary array being created. It seems kata is not properly described.
NO proper description, no test cases waste of time.
Please check if you can find anything helpful in this FAQ and if you tried everything and still no success, please share your code with us so we could take a look (remember about markdown formatting and spoiler flag). It is possible that there is some issue in the kata, but since you are the first one to report such problem, I somehow do not think it's really the case here.
I have used sort but took care of it during number comparision, and when I take the same random test and try it out in codepen I am able to get the expected result, 10 test cases are failing on clicking attempt. And whats more weird is when i try to use console.log() for input I am seeing 13 test cases failing. Very weird behaviour.
There is no issue with the kata, if you're using sort, it's not stable in javascript and that could be your problem.
I think there is an issue in the kata, like I am checking with my editor for even random tests its working but here it's not working. Could please help me out raising the issue.
Once I decoded the logic I felt it bit simple, but yes to get through right logic was the tough part. It was a nice kata.
Enjoyed doing the kata.
Thankyou for providing a brief explaination regarding the Regexp. Very informative content.
New CFML Translation!
Loading more items...