Ad
  • Default User Avatar

    I really like this solution, though I have one small nitpick.

    You don't really need to reassign nd = i + k everytime a new maxSum is found, since the starting index of that sum is already being saved.

    So the final for loop that builds the resulting string would instead look like this:

    for(int c = start; c < (start + k); c++)

  • Default User Avatar

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