Skip to main content
PProfileMatch
← Path

Arrays and Strings · Arrays and Strings: List Mechanics, In-Place Updates, Two Pointers

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Bike shop: checking the chain

Trick to keep in mind+3 XP

Count the shifts: touching index 0 moves every other element.

A list is one contiguous block of slots. Reading or writing a slot by index is a direct jump, and adding at the right end only needs a free slot. Adding at the front means making room, so each existing item moves one place over. With n items that is about n moves per insert.

Read it once, then a question tests whether the trick stuck.