Arrays — Easy
Quiz

Array basics

Quick sanity check on indexing, complexity and the two-pointer pattern.

5 questions
  1. Q01multiple choice
    What is the time complexity of finding the maximum element in an unsorted array of n integers?
  2. Q02multiple choice
    Why does the standard 'second largest' algorithm need to track BOTH the largest and the second largest in the same loop?
  3. Q03multiple choice
    An array is sorted in non-decreasing order if for every adjacent pair a[i-1] and a[i], it holds that ...
  4. Q04fill in the blank
    In the in-place 'remove duplicates from a sorted array' algorithm, the two pointers are usually called 'read' and 'write'. After the loop finishes, the new length of the unique-values prefix is _____ + 1.
  5. Q05fill in the blank
    In the 'move zeros to end' algorithm, we use a _____ operation rather than a copy because we also need to push the existing zero somewhere to the right.