2 <= n <= 58
| 15 | public: |
| 16 | // 2 <= n <= 58 |
| 17 | int integerBreak(int n) { |
| 18 | if (n == 2) return 1; |
| 19 | if (n == 3) return 2; |
| 20 | if (n == 4) return 4; |
| 21 | int n3 = 0; |
| 22 | while (n >= 5) { |
| 23 | n3 ++ ; |
| 24 | n -= 3; |
| 25 | } |
| 26 | return fast_pow(3, n3) * n; |
| 27 | } |
| 28 | |
| 29 | int fast_pow(int x, int y) { |
| 30 | int res = 1; |
nothing calls this directly
no outgoing calls
no test coverage detected