Ad
  • Custom User Avatar
  • 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.