Min Jumps With +i -i Moves
easy
1. Given an integers X. 2. The task is to find the minimum number of jumps to reach a point X in the number line starting from zero. 3. The first jump made can be of length one unit and each successive jump will be exactly one unit longer than the previous jump in length. 4. It is allowed to go either left or right in each jump.
Constraints
None
Format
Input
X = 8 X = 9
Output
4 -1 -> 2 -> 3 -> 4 (order of jumps) 5 1 -> 2 -> -3 -> 4 -> 5 (prder of jumps)
Example
Sample Input
9
Sample Output
5