The function appears to work correctly for the inputs I tested, but there may be some edge cases where the function does not behave as expected.

I hope this helps! Let me know if you have any other questions or if you would like me to run more experiments to further test the function.