My Easy C++ Solution


  • 1
    G
    class Solution {
    public:
        int maxA(int N) {
            int res = N;
            for (int i = 1; i < N - 2; ++i) {
                res = max(res, maxA(i) * (N - 1 - i));
            }
            return res;
        }
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.