LeetCode 754: Reach a Number
Problem Restatement We start at position 0 on an infinite number line. There is a destination at position target . On move 1 , we must move exactly 1 step. On move 2 , we must move exactly 2 steps. On move 3 , we must move exactly 3 steps. In general, on move i , we must move exactly i steps. For every move, we can choose either direction:...