isPossible(maxVal, divisor1, divisor2, uniqueCnt1, uniqueCnt2) that returns true if maxVal can be the maximum value in either array without violating the constraints.isPossible, calculate the number of integers up to maxVal that are not divisible by divisor1 and divisor2 respectively, and the number of integers not divisible by either.uniqueCnt1 and uniqueCnt2 after accounting for integers that are not divisible by either divisor.[1, 2 * (uniqueCnt1 + uniqueCnt2)] to find the minimum maximum value.isPossible(mid) is true, update the answer and search the lower half; otherwise, search the upper half.