4 ms·
2 pointers, i and j, one for each array. I would have a while loop run for length of the arrays / 2 times. I would increment one of the pointers with each itera
by Tmp1234 8y ago
2 pointers, i and j, one for each array. I would have a while loop run for length of the arrays / 2 times. I would increment one of the pointers with each iteration based on which array had the next biggest number. When the while loop was done one of those pointers would be pointing the median if the length of both arrays summed to an odd number and I would return it. If the length was even, I would need to get the next biggest number from either array and average it with what would be the median if it was odd and then return that.