Problem Statement Given two sorted arrays nums1 and nums2 , return the median of the two sorted arrays. The overall run time complexity should be: O(log(min(N,M))) Brute Force Intuition In an interview, you can explain it like this: Since both arrays are sorted, we can merge them into a single sorted array and then directly compute the median from the merged array. Complexity Time Complexity: O(N + M) Space Complexity: O(N + M) Brute Force Code int [] merged = new int [ n + m ]; // Merge both ar