HomeClumsy Factorial 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution: def clumsy(self, n): if n == 1: return 1 elif n == 2: return 2 elif n == 3: return 6 elif n == 4: return 7 else: if n % 4 == 0: return n + 1 elif n % 4 <= 2: return n + 2 else: return n - 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class Solution: def clumsy(self, n): if n == 1: return 1 elif n == 2: return 2 elif n == 3: return 6 elif n == 4: return 7 else: if n % 4 == 0: return n + 1 elif n % 4 <= 2: return n + 2 else: return n - 1