Read this first — it is the point of the contest
When the data is sorted, or when you care about a contiguous stretch, you rarely need nested loops. Two indices walking the array carry all the state you need.
Two pointers — one from each end:
left, right = 0, len(s) - 1
while left < right:
if s[left] != s[right]:
return False
left, right = left + 1, right - 1
Sliding window — both pointers moving forward, the window growing and shrinking:
start = 0
for end, ch in enumerate(s):
while breaks_the_rule(ch):
start += 1 # shrink from the left
best = max(best, end - start + 1)
Both turn an O(n²) scan into O(n) because each element is visited a constant number of times. Being able to say why it is linear — "every element enters and leaves the window exactly once" — is the answer they are listening for.
Nobody on the board yet
Earn XP by finishing lessons, solving problems and reviewing — the first people to do so appear here.
Contest points are awarded for solutions written in the editor. We record how much of each submission was typed versus pasted — a pasted solution still counts as solved for your own learning, but it does not score here. This is stated up front so nobody is caught out.