Algorithm · Squarepoint · Medium
Given two integer arrays a and b, each already sorted in non-decreasing order, and an integer target, determine whether one value from a and one value from b can be added to produce target. More formally, return true if there exist indices i and j such that $$a[i] + b[j] = target$$, and return false otherwise. The arrays may have different lengths. Your algorithm must run in $$O(m + n)$$ time and use $$O(1)$$ extra space, where $$m = a.length$$ and $$n = b.length$$. Example…
Checking your access…