Topic: Array Pair Sum Optimization
Given a binary array 'nums', you are required to find the maximum length of a contiguous subarray that contains an equal number of 0s and 1s.

Explanation:

A binary array is an array that contains only 0s and 1s.
A subarray is any subset of the indices of the original array.
A contiguous subarray is a subarray in which all the elements are consecutive, i.e., any element between the first and last element of the subarray is also part of it.
Examples:
Input :nums = [0, 1]
Output : 2
Explanation: The longest contiguous subarray with an equal number of 0s and 1s is [0, 1] with a length of 2.
Input : nums = [0, 1, 0]
Output : 2
Explanation: The longest contiguous subarray with an equal number of 0s and 1s is either [0, 1] or [1, 0], both with a length of 2.
Input : nums = [0, 0, 0, 1, 1, 1]
Output : 6
Explanation: The longest contiguous subarray with an equal number of 0s and 1s is [0, 0, 0, 1, 1, 1] with a length of 6.
The problem requires finding the maximum length of a contiguous subarray in the binary array 'nums' that contains an equal number of 0s and 1s.

Topic: Array Pair Sum Optimization
Help me solve the following qn. Please provide a intuitive easy to understand step by step solution:

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.