Complete the code to initialize the left pointer at the start of the array.
int left = [1];The left pointer starts at index 0, the beginning of the array.
Complete the code to initialize the right pointer at the end of the array.
int right = [1] - 1;
The right pointer starts at the last index, which is array.length - 1.
Fix the error in the while loop condition to continue while left is less than right.
while ([1] < right) { // process }
The loop should run while left pointer is less than right pointer.
Fill both blanks to move pointers correctly: increment left and decrement right.
if (sum < target) { [1]++; } else { [2]--; }
When sum is less than target, move left pointer right to increase sum. Otherwise, move right pointer left to decrease sum.
Fill all three blanks to create a two-pointer loop that finds pairs summing to target.
while ([1] < [2]) { int sum = array[[1]] + array[[2]]; if (sum == target) { return true; } else if (sum < target) { [1]++; } else { [2]--; } } return false;
The loop runs while left is less than right. sum is calculated using left and right indices. If sum is less than target, increment left; else decrement right.
