simple and easy C++ solution 😍❤️‍🔥
if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n\nclass Solution {\npublic:\n    int findMaximizedCapital(int k, int w, vector<int>& profits, ve
# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n```\nclass Solution {\npublic:\n    int findMaximizedCapital(int k, int w, vector<int>& profits, vector<int>& capital) \n    {\n        vector<pair<int,int>>store;\n        int n = capital.size();\n        for(int i=0;i<n;i++)\n            store.push_back({capital[i], i});\n        sort(store.begin(), store.end());\n\n        int ans = w, i = 0;\n        priority_queue<int>pq;\n        while(k--)\n        {\n            while(i < n and store[i].first <= ans)\n                pq.push(profits[store[i++].second]);\n            if(pq.empty()) break;\n            ans += pq.top(); pq.pop();\n        }\n        return ans;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'C++']