C++ | sub-mask enumeration | O(3^n)
We can reach a mask from all of its submasks.\n```\nclass Solution {\npublic:\n    int minSessions(vector& tasks, int sessionTime) {\n        int n = tasks.size
We can reach a mask from all of its submasks.\n```\nclass Solution {\npublic:\n    int minSessions(vector<int>& tasks, int sessionTime) {\n        int n = tasks.size();\n        vector<int> dp(1 << n, 100000);\n        for (int mask = 0; mask < 1 << n; mask++) {\n            int req = 0;\n            for (int i = 0; i < n; i++) {\n                if (mask & 1 << i) req += tasks[i];\n            }\n            if (req <= sessionTime) dp[mask] = 1;\n            \n            for (int smask = mask; ; smask = mask & (smask - 1)) {\n                if (dp[smask] + dp[mask - smask] < dp[mask])\n                    dp[mask] = dp[smask] + dp[mask - smask];\n                if (smask == 0) break;\n            }\n        }\n        return dp[(1 << n) - 1];\n    }\n};
[]