🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Two Pointers Quiz: questions with answers

8 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What must usually be true of an array to use opposite-end two pointers for a pair sum?
  2. Q2. In Two Sum II (sorted array), the current sum is SMALLER than the target. What do you do?
  3. Q3. What is the time and extra space of two-pointer Two Sum on a sorted array?
  4. Q4. In Container With Most Water, which pointer should move?
  5. Q5. What does nums look like after this code runs on [0, 1, 0, 3, 12]? (code)
  6. Q6. Why does 3Sum sort the array first? (select all that apply)
  7. Q7. When merging two sorted arrays into the first array's extra space, from which end do you fill?
  8. Q8. Is "racecar" a palindrome? Type yes or no.