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 has nested loops and can not be considered as a
Best Practice
. I have implemented this inO(n)
time order.Yes, I agree on that. I opt for staying close to intent and optimize when needed. But as long as you know the function exists, I'm happy ;)
Cheers!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Yes, it's by default. It's not marked as a big warning, but as a suggestion. To me, I repeat, it's such a small difference that I think it's a matter of taste :) If i had to back up this in a more objective way, I would resort to the DRY principle. Writing
string a = ''
is like saying to time that it is a string, hence providing redundant information. I don't think thatvar a = ''
has any readability problem :).As I said, I don't think it's weird, just stylistic decisions :)
I can commit only a certain amount of time to codewars, I try to do the best I can in a reasonable amount of time :)
I don't think that 'var' needs to have teams. I'm intrigued by your preference for type inference particulary in a .NET language where the IL implies type inference.
I like to write code that is functional and humans can understand. In my experience, the use of 'var' at best reduces the width of a line of code and at worst obfiscates the purpose of the code from those who didn't write it. The first is an inconvenience and the second can lead to many problems. Does resharper want to modify all your code to use 'var'? Weird.
Always code like it's real... :)
Thanks for commenting :)
I guess that
var
has a lot to do with opinions and personal feeling of the coder, is difficult to say what is better to use objectively, whether var or the actual type. Personally, I usevar
everywhere, probably because I am addicted to resharper, it's concise, and because I like to use type inference whenever I can, but as I said, I think it's more a matter of taste.If I had to put this code in a real project, I guess I would have added a documentation for
Seq
, and maybe chose a better name :)How did the use of var enhance your code?
What does "seq" mean? Would someone else maintaining this code have any suspicion as to the goal you had?
try with
.Trim()
? maybe the whitespace is on the other sideYou should look into
StringBuilder
if you don't want to dry up your memory ;)that's true, also
ToList
=)Yes. So is ToList.
Isn't the OfType redundant?