how did you get 36 here?

in approach 2

Input -

x=5 , y=41

Difference = 36

So, 36 is maximum number of steps needed to achieve 41 from 5 (just add '1' 36 times)

what would be minimum number of steps?You will obviously minimize 36 to an extent which is possible.

Understood?

Can you please explain, for x<y, if the difference is even and it will be not divisible by 2… how can we moves in 2 steps?

you can’t do that in 2 steps it will take 3 because even +odd(a) -even(b)=odd so never gonna get 10 or would you explain if something Is wrong with my explanation for x=2 and y=10

Sure.

For X = 4 , Y = 10, add 3 twice, So min steps = 2

For X = 2 , Y = 10, add 5 twice. So min steps = 2

we can do this

a=36 ,b=1

x+36=y

1 round only

Read the question again Buddy!

if x=6 and y=10

So the difference is 4 which is divisible by 4 ,accoridng to the solution the answer must be 3 but

10 can be achieved by adding +3 and +1 so no.of steps is 2.

can anyone please explain this?