Very easy observation based solution using math in C++!!!!!
\n# Intuition\nObserve a particular breaking pattern.\n# Approach\nPattern is given as follows:\n2 = 1\n3 = 3\n4 = 2 x 2\n5 = 3 x 2\n6 = 3 x 3\n7 = 3 x 2 x 2\n8
\n# Intuition\nObserve a particular breaking pattern.\n# Approach\nPattern is given as follows:\n2 = 1\n3 = 3\n4 = 2 x 2\n5 = 3 x 2\n6 = 3 x 3\n7 = 3 x 2 x 2\n8 = 3 x 3 x 2\n9 = 3 x 3 x 3\n10 = 3 x 3 x 2 x 2\n11 = 3 x 3 x 2\n12 = 3 x 3 x 3 x 3\n13 = 3 x 3 x 3 x 2 x 2\n14 = 3 x 3 x 3 x 3 x 2\n\nApproach:\nWe can observe that breaking a number down into 3s and 2s contributes more to its multiplication.\nTo determine how many threes and twos are required to represent a number through its sum, we can consider three cases:\nCase 1: When \'n\' is a multiple of three, we require \'n/3\' threes.\nCase 2: When \'n-1\' is a multiple of three, we require \'n/3 - 1\' - threes and \'2\' twos (since 2*2 = 4).\nCase 3: For all other cases, we need \'n/3\' threes and \'1\' two.\n\n\nDo Upvote if u like my approach.:)\n\n# Complexity\n- Time complexity:\nO(log N)\n\n - Space complexity:\nO(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int integerBreak(int n) {\n        if(n==2) return 1;\n        if(n==3) return 2;\n        int x = n/3;\n        if(n%3==0) return pow(3,x);\n        else if((n-1)%3==0) return pow(3,x-1)*4;\n        else return pow(3,x)*2; \n    }\n};\n```
['Math', 'C++']