Ad
  • Default User Avatar

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

  • Custom User Avatar

    C# offer a rich language with a rich toolbox, it's a shame to not use them. If not, please provide a real 'ultimate' solution.

    So I will give a little review on why I consider it is not a Best practice nor a Clever solution :

    • usage of 'foreach' loop with an array is not good for perf (nor so much compatible with others langages)
    • why curIndex start with -1 and it is incremented before it's first use. Initialize it with 0, this is the REAL current position and post-increment it (in on sentence or after assignation)
  • Default User Avatar

    Most of the solutions were done by using linq that are not gonna work with other languages. Your solution is ultimately the best and overall.