josh yen wrote:This probably is not enough info, but thank you anyways!
It is - I wrote my own calling code, using the Example 1 inputs you've given, and when I ran it I got a segmentation fault - a runtime error. I suspect it's the same underlying error as the one you've quoted, but some additional run-time checking has been enabled to give your error message.
If it was my code I would now start adding the C++ equivalent of C printf statements (I'm a C programmer) to find out where it's going wrong. I don't know anything about 'LeetCode', and I'm too lazy to look it up - does it allow you to do that?
My calling code - apologies for the C-ness: