Ad
  • Custom User Avatar

    You can look up the 1 to n math formula. When you learn sums of series in school you often learn the 1 to n formula and you have to reorginize it with two variables to get from a to b.

  • Custom User Avatar

    I ran into this too. Looks like it says new array in the problem statement.

  • Custom User Avatar

    shouldn't the condition i < numbers.size() - 1 be enough to check for the size being <= 1. The for loop shouldn't run at all in that case and the empty vector would get returned. I find the need for a redundant check case confusing. It would seem to me that this is a bug, or an idiosyncrosy of how codewars treats c++?

  • Custom User Avatar

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