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.
Fixed the random tests ( reference solution was sorting inputs ). If you pass the random tests by chance, enjoy the cheap points.
Thanks for flagging this. Random tests are generated dynamically every test run so unfortunately there's no way to know the edge case that failed. Will keep tabs on this.
You're not printing the input, you're printing
'hello?'
there.Number of operations in the inner loop does not depend on
n
, so it's not going to be O(n^2). As you noticed, inner loop always performs a limited number of operations (two or three, if I count correctly, except a single iteration when the unique number is encountered), and only the outer loop executesn
times.The complexity would be O(n), or very close to it, but still with unnecessarily high constant factor.
Thanks for this, now i get it why it's giving an error
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions