Skip to content

Two ends of a string

Read · 1 of 3

Two pointers

Put one finger at the start (l) and one at the end (r). Compare, then move both inwards. When they meet, you've checked everything in half the steps.