Merge both arrays, then find the median at position (m + n) / 2.
Merging takes time and space.
The problem requires . You need a way to find the median position without building the merged array.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Merge both arrays, then find the median at position (m + n) / 2.
Merging takes time and space.
The problem requires . You need a way to find the median position without building the merged array.