Leetcode 754. Reach a Number
Find the minimum k such that by taking moves of lengths 1..k (each either left or right) you can land at target; this reduces to finding the smallest k with S = k(k+1)/2 >= |target| and S and |target| having the same parity (so S - |target| is even).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.