Engrain by ByteRush

DSA.06 4 concepts

Array and string patterns

Master the four most common array patterns.

  1. DSA.06.01Pattern 1: Two pointersCoreJuniorBeing written
  2. DSA.06.02Pattern 2: Sliding windowCoreMid-levelBeing written
  3. DSA.06.03Pattern 3: Prefix sumsCoreMid-levelBeing written
  4. DSA.06.04Pattern 4: Hashing and countingCoreJuniorBeing written

Interview questions in this module

  1. When does the two-pointer technique work? Why must the input often be sorted?
  2. How do you recognise a sliding-window problem?
  3. Why does the sliding window fail with negative numbers, and what do you use instead?
  4. Find the number of subarrays whose sum is k in O(n).
  5. Group anagrams efficiently. What key do you use?