This is a tricky little leetcode problem:
https://leetcode.com/problems/median-of-two-sorted-arrays/
Here are some of my observations on a whiteboard:
There are a lot of fiddly edge cases. I think my solution could be simplified but here is the gist anyway:
https://gist.github.com/adamkorg/ffba283f298e7c2c2b748acb49ccc9f1