Complete the code to initialize the left pointer at the start of the array.
let left = [1];The left pointer should start at index 0 to begin from the start of the array.
Complete the code to initialize the right pointer at the end of the array.
let right = [1];The right pointer should start at the last valid index, which is array.length - 1.
Fix the error in the while loop condition to continue while left is less than right.
while (left [1] right) { // logic here }
The loop should run while left is less than right to avoid overlapping pointers.
Fill both blanks to move the left pointer right and the right pointer left inside the loop.
if (array[left] + array[right] === target) { left[1]; right[2]; }
Increment left pointer with ++ and decrement right pointer with -- to move inward.
Fill all four blanks to adjust pointers based on sum comparison with target.
if (sum < target) { left[1]; } else if (sum > target) { right[2]; } else { result.push([left, right]); left[3]; right[4]; }
Increment left pointer if sum is less than target, decrement right pointer if sum is greater, and move both pointers inward when sum equals target.
