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 code does not pass the C++ tests anymore
bro this is so wrong xD
Not sure why some are suggesting O(log n). Binary search only works on an ordered set. These numbers are not ordered. The fastest you can possibly achieve this is O(n). You must iterate through all the digits to ensure even the very last digit is within the rules.
While slower than the closed form, it certainly is more evocative of the actual problem description. And if it were written in 'math' (Capital Sigma notation), this would be defintion of the problem. Nice.
was my first choice
sometimes I am so stupid it is astounding. I make things so much harder than it needs to be
Namely, here: https://docs.python.org/3/library/stdtypes.html#set
check the api docs?
This comment is hidden because it contains spoiler information about the solution
Not all letters in 'hello' are present in 'hi'; so it's false.
I don't understand where do you think the problem is.
Thank you for your comment anyway.
This is not correct. What if arr[0] is 'hi' and arr[1] is 'hello'?
Edit: this example is not valid
This comment is hidden because it contains spoiler information about the solution
This won't work if we take something like
[-2, -1, 10, 1, 2]
.Fixed. Thanks for reporting.
Look at the other solutions. You will see that there are ways to build the result forward without a temporary list.
Loading more items...