Question
Given two arbitrary arrays(with possible duplicate), pick one element from each of the array, find all pairs with the largest sum <= target.
TC: O(mlogm + nlogn + n logm), assume n is smaller
step1 确定能用2pointer,相向
step2 initialzation of i,j position
TC: O(nlogn + mlogm + m+ n)
Last updated 2 years ago