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.
Thanks for saying why it works.
the fun fact, is you used the same exact code as mine... even the name of vars xD or the structer, I really find it strage we both used it this way
exactly, if not zero it is false? while if S1 is larger it should be true
because it means it contianed all the letters required and more
so I am a little bit confused, what if s1 has more length, more letter for each alphabet, it should not be 0?
This comment is hidden because it contains spoiler information about the solution
I forgot to say why I assumed the other solutions as 2n,
well because they compare on every iteration both elements
(to make you realize how bad is it, just assume the array is sorted try 10 numbers array)
see how many swaps and how many comparisons for such algorithm
to build an intuition on how bad it is.
This comment is hidden because it contains spoiler information about the solution
if list are worse then I may suggest sets?
and btw, the idea I meant wasn't about dict or list more than about why counting frequencies of words when all we need to do is terminating when the first repeatition occurs.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I know there are many solutions however why do you want to use dictionaries? you are counting the frequencies of the letters which is not needed
you can terminate right away when a repeat is occur, I did that in my solution you can check it if you like however, you can solve this with list, tuples dict and sets
I would say list would be the best since there is no need to use a dictionary.
Can you give me a solution that is than mine, thanks in advance
And since 2 people already said it.
I will say it in advance if you read my code closely my solution takes O(n+sqrt(n)) which is faster
than O(2n)
so If you know any solution that is faster than mine I am very happy to hear from you.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
My solution is faster, I can't understand how the best solution is being slow....
even thought it's reading complexity is almost zero while mine... I had to put documentation to make it readable haha
Loading more items...