Ad
  • Custom User Avatar
  • Custom User Avatar

    Thank you very much for timely help! I'm just learning and don't know how significant are the differences between array and vector. Kata is good for practice.

  • Custom User Avatar

    The code you showed above is invalid, it introduces UB due to use of an uninitialized variable (result is uninitialized and not written to, if the arr is empty). The passing tests are a result of handling the UB by compiler. It is difficult to write tests in a way to protect against such problems (it's UB after all), and I am not sure if this issue can be universally fixed.

  • Custom User Avatar

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