Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int integerBreak(int n) {
- if(n == 3)return 2;
- if(n == 2)return 1;
- if(n == 1)return 1;
- int prod = 1;
- while(n>4)
- {
- prod*=3;
- n-=3;
- }
- prod*=n;
- return prod;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement