I have two pieces of code on my machine (one iterative and one recursive), both of which work perfectly well in all cases. However, weirdly, the recursive one fails on the test provided here, even though the arrays for which it fails actually work just fine on my computer. No clue what the issue can be.
Somewhere, a compiler is weeping, but your solution works hopefully!
This comment is hidden because it contains spoiler information about the solution
I have two pieces of code on my machine (one iterative and one recursive), both of which work perfectly well in all cases. However, weirdly, the recursive one fails on the test provided here, even though the arrays for which it fails actually work just fine on my computer. No clue what the issue can be.