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.
Should be the top answer! I did it yesterday on Leetcode and started off brute forcing with nested
for
loops (like the top answer here), but found out how inefficient that is. This is the given solution there btw (which also has an explanation I learned a lot from).No, it will fail with an
ArrayIndexOutOfBoundsException
.my face reading this be like: [^_-]
It means that by snydergd's definition and mine, your description of this solution makes it clever as it is efficient, doesn't use obscure language features and can be used in prod. If you feel like this solution is as you described it and is not clever, your definition of clever seems to be a bad definition.
I'm so mad I didn't think of this lol
The
in
operator has an average-case time complexity ofO(1)
when applied to dictionaries in Python, and this solution therefore has an overall average-case time complexity ofO(n)
.Nice solution. By the way, I have a question - is this solution O(n^2) (one n from loop and another from 'in' operator), or it is more efficient?
Big Brain
Could be people copying answers they want to dissect and understand better and then clicking "Submit" to run against the attempt test cases instead of forking them.
return
is incorrect
Beautiful layout!
I think when they were unable to make it, unlocked solutions and copied to see how it works
It's goood
cheating
Very interesting solution
Loading more items...