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.
This is a very risky idea for a kata: easy to solve (with built-in random generators provided by standard libraries), and very difficult to test (testing for randomness id not an easy task).
iirc, such idea has been done before ~~ feel free to come to discord for a better / quicker response !
That's because your code is wrong. You need to improve it.
There are some random test cases. They differ every time. So that's why you get different numbers of passed tests.
Please mark your posts as having spoiler content next time.
Yes, it can. Your solution has complexity of O(n^2), and is more or less equivalent to a loop nested in a loop because
count
goes through whole array every time.The kata can be solved in O(n), since it's enough to iterate over the array only once to solve it.