filmov
tv
Leetcode 754 (Medium) Reach a Number in Javascript

Показать описание
You are standing at position 0 on an infinite number line. There is a goal at the position target.
On each move, you can either go left or right. During the n-th move (starting from 1), you take n steps.
Return the minimum number of steps required to reach the destination.
On each move, you can either go left or right. During the n-th move (starting from 1), you take n steps.
Return the minimum number of steps required to reach the destination.