991. Broken Calculator Time: Space: C++JavaPython 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16class Solution { public: int brokenCalc(int X, int Y) { int ops = 0; while (X < Y) { if (Y % 2 == 0) Y /= 2; else Y += 1; ++ops; } return ops + X - Y; } }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15class Solution { public int brokenCalc(int X, int Y) { int ops = 0; while (X < Y) { if (Y % 2 == 0) Y /= 2; else Y += 1; ++ops; } return ops + X - Y; } } 1 2 3 4 5 6 7 8 9 10 11 12class Solution: def brokenCalc(self, X: int, Y: int) -> int: ops = 0 while X < Y: if Y % 2 == 0: Y //= 2 else: Y += 1 ops += 1 return ops + X - Y