Median of Two Sorted Arrays (LeetCode 4)The problem You get two sorted arrays (length ) and (length ). Return the…