A lesson from the Data Structures module of the bootcamp. About a 10 minute read.
A string is an array of characters with one extra rule: in most languages you cannot change it. That one rule is behind most string performance bugs. The rest of the topic is a small set of habits.
A string is an ordered sequence of characters. You can index it like an array with s[0] and walk it one character at a time. Everything from the arrays lesson carries over, including the cache behavior, which is why scanning a string is about as fast as scanning anything gets.
The rest of this lesson continues with 4 further sections. See the full curriculum.
Browse all 576 practice puzzles