Module 3 · string: Text That Knows Its Own Length
CP and Interview Pack: string Patterns, Questions and the Bug Gallery
ProReading
Codeforces Round 295 (Div. 2) opened with problem 520A, "Pangram". Given a word of small and capital Latin letters, print YES if every letter of the alphabet appears in it, ignoring case, and NO otherwise. Bob started writing 26 if statements. Amara wrote one array of 26 counters, and her whole solution is pattern 2 below.
Checking what this lesson needs for you…
What is inside CP and Interview Pack: string Patterns, Questions and the Bug Gallery
- Pattern 1: a palindrome, with two pointers
- Pattern 2: letter counts in an array of 26
- Pattern 3: reversal, of a word and of the words in a line
- Pattern 4: a split helper you keep
- Pattern 5: big numbers as strings, one digit at a time
- Six interview questions, with model answers