MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / clumsy

Method clumsy

Python/clumsy_factorial.py:2–16  ·  view source on GitHub ↗
(self, n: int)

Source from the content-addressed store, hash-verified

1class Solution:
2 def clumsy(self, n: int) -> int:
3 if n == 1:
4 return 1
5 if n == 2:
6 return 2
7 if n == 3:
8 return 6
9 if n == 4:
10 return 7
11 if n % 4 == 0:
12 return n+1
13 if n % 4 == 1 or n % 4 == 2:
14 return n+2
15 if n % 4 == 3:
16 return n-1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected