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.
Dubious because:
While this solution might look cleaner it has an O(nlog(n)) time complexity in the best case.
This could easy have an linear time complexity using a hash-map.
This comment is hidden because it contains spoiler information about the solution
why long?
clever!!
but ineffiecient due to:-
you should really make an array for counting repeats (i.e. frequence array or ans unordered map);
wow! I didn't knew you could use end[-1] insted of *(end - 1) as well;
THANK YOU!