Ad
  • Default User Avatar

    If you start doing locale-specific processing, what are you going to do when you encounter all those not so trivial cases like Greek sigma, German eszett, Dutch ij; going further, diacritics, Unicode composed/decomposed graphemes? This problem isn't even defined for those cases, so ToLowerInvariant looks like a good choice.

  • Custom User Avatar

    better to use: word.ToLower(CultureInfo.CurrentCulture);
    nice you cared about the culture, but CurrentCulture will be a better use -> Common Mistake #3 -> https://www.toptal.com/c-sharp/top-10-mistakes-that-c-sharp-programmers-make

  • Custom User Avatar

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

  • Custom User Avatar

    using peopleInLine.Count() is a bad practice when you have the Length available, also you might not want to use it in a loop, in this case int[] implements ICollection, so it will return the Length in O(1) complexity.
    but if you had another type of IEnumerable that does not implements ICollection it would have count the total collection in O(N) complexity, in each loop iteration - resulting to a undesired complexity of O(N ^ 2).