Ad
  • Custom User Avatar

    This has nested loops and can not be considered as a Best Practice. I have implemented this in O(n) time order.

  • Custom User Avatar

    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!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Does resharper want to modify all your code to use 'var'

    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 that var a = '' has any readability problem :).

    Weird.

    As I said, I don't think it's weird, just stylistic decisions :)

    Always code like it's real... :)

    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 :)

  • Default User Avatar

    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... :)

  • Custom User Avatar

    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 use var 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 :)

  • Default User Avatar

    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?

  • Custom User Avatar

    try with .Trim()? maybe the whitespace is on the other side

  • Custom User Avatar

    You should look into StringBuilder if you don't want to dry up your memory ;)

  • Custom User Avatar

    that's true, also ToList =)

  • Custom User Avatar
  • Custom User Avatar

    Isn't the OfType redundant?