Minimum jumps to traverse all integers in range [ 1 , N ] such that integer i can jump i steps | Java implementation of the above approach ; Utility function to find minimum steps ; Driver code ; Input integer ; Function call
using System ; class GFG { static int minSteps ( int N ) { int res = ( ( int ) Math . Sqrt ( 1 + 8 * N ) - 1 ) / 2 ; return res ; } public static void Main ( String [ ] args ) { int N = 6 ; Console . Write ( minSteps ( N ) + " STRNEWLINE " ) ; } }