Practice · 2 of 3
Border Patrol
CHALLENGE
Difficulty: advanced+25 XP
**Problem.** Given a string s, count its border lengths: every 1 <= l < |s| with s[0..l) == s[|s|-l..|s|). **Constraints:** 2 <= |s| <= 2000001. Checking every length by direct comparison is the classic near-miss.
Press Submit to check your solution.
Back to lesson: Practice: Mixed Drill — Trees and Strings