Please explain solution to broken caluculator from leetcode?
Please explain solution to broken caluculator from leetcode?
You can manipulate the question as if x>=y then x-y operations required else if y is odd increment y by 1(equivalent to decrease x by 1 as separation is same in both cases) if y is even then divide y by 2(equivalent to multiply x by 2). Now, try to solve the problem.