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.
yes, but that's only because this is a subset of a more general problem. Let's apply the very same algo to something with a larger "alphabet" (=> larger set size), and this algo becomes suddenly
O(m*n)
(n: size of the array, m: size of the set/alphabet), which isn't linear anymore.n + 2 * n is still O(n)...
+1 me 2
This comment is hidden because it contains spoiler information about the solution
Your solution isn't O(n) though