← Goldman Sachs questions

Minimum steps to reach destination on number line

Filed under Goldman Sachs

You are at position 0 on an infinite number line. On the n-th move, you take n steps either left or right. Find the minimum number of moves required to reach a given target position.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Goldman Sachs questions

Collected from public candidate posts and coding forums. Updated Nov 2026.