These are the two-pointer problems every placement candidate should be able to solve, from a sorted pair sum to counting triangles. Pick the pattern first: pointers from both ends, read and write, or fast and slow. Trace a small input on paper, then check your program against every test.