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.
I be so excited to complete a challenge with my 32 lines of code then come here and see this TT_TT
Linq is just using someone else code.
lol
haha, 4 years ago, long time no see, nice to meet you , i am fine ,thank you, xixi
HEAT!
I think .ToString() here would print System.Collection. etc... but not the result. But would have to test it.
This comment is hidden because it contains spoiler information about the solution
I totally don't get why such solutions are voted as best practices. It's really hard to look at such line and tell what it does.
Do one-liners look cool? Yes.
Is it clever for knowing the right library methods for the situation? Yes.
Is it the best practice? Absolutely not, code should be easy to understand.
I just hope that nobody writes like this in prod
还有这种操作。。。
That's theory on complexity and if we follow, we should say that what you propose is O(n*m) where m is the number of letters a-z i.e. the size of your boolean array. Now, the log(n) part is less than that for even the largest possible memory of a single computer. And while I agree that m can be considered constant, the O(nlogn) solution will be faster in any practical application. That's theory. And when it comes to other things like readability, then, well the code speaks for itself :)
Nevertheless, you come through array for 3 times (2 foreach, 1 for), while solution on the top goes twice. But your idea is pretty interesting.
Being strict, for very long strings this will take O(nlogn); I've used an array of booleans and I set an element to true if its character is found. At the end my solution is O(n). Please take a look at let me know what you think :)