Skills101
← All practice quizzes

Two Pointers Quiz

8 questions10 minPass: 60%+10 XP on first pass

Opposite-end pointers, in-place read/write pointers, 3Sum and Container With Most Water.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What must usually be true of an array to use opposite-end two pointers for a pair sum?

  2. Question 2

    In Two Sum II (sorted array), the current sum is SMALLER than the target. What do you do?

  3. Question 3

    What is the time and extra space of two-pointer Two Sum on a sorted array?

  4. Question 4

    In Container With Most Water, which pointer should move?

  5. Question 5

    What does nums look like after this code runs on [0, 1, 0, 3, 12]?

    write = 0
    for read in range(len(nums)):
        if nums[read] != 0:
            nums[write], nums[read] = nums[read], nums[write]
            write += 1
    
  6. Question 6Select all that apply

    Why does 3Sum sort the array first? (select all that apply)

  7. Question 7

    When merging two sorted arrays into the first array's extra space, from which end do you fill?

  8. Question 8

    Is "racecar" a palindrome? Type yes or no.