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.
amazing
Nice.
This solution mutates the input, which could cause unexpected side-effects for the caller.
ternary operator does work
(bool)?(if true):(false)
OK you're right
Yeah, it does.
It is not actually brute force. It's O(n). Brute force here would be O(2^n) aka exponential.
And if you run your solution and his, you'll see, they both take around 50ms
Doesn't give the right answer for the large test?
Brute Force isn't very good, read on Dijkstra
The most "production-ready" solution, IMO. Really clean and efficient.
This comment is hidden because it contains spoiler information about the solution
All great, but why IsSmiley returns int? Is... should answer true or false, and then you can just count where its true: smileys.Count(IsSmiley);
This is the most readable solution. And it references the combination solution.
This comment is hidden because it contains spoiler information about the solution
Skipping one element and then checking if any left should be faster than counting since it runs in constant time instead of linear, hopefully making up for the extra function call. I also introduced C# 6 syntax, changed some formatting and rewrote the test suite (trying to keep and clarify the orthogonality of the tests).
Loading more items...