Leetcode 1033 Solution
This article provides solution to leetcode question 1033 (broken-calculator)
Access this page by simply typing in "lcs 1033" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/broken-calculator
Solution
class Solution:
def brokenCalc(self, X: int, Y: int) -> int:
ans = 0
while Y > X:
ans += 1
if Y % 2:
Y += 1
else:
Y = Y // 2
return ans + X - Y