Priority-Queue||C++
\nclass Solution {\npublic:\n    int findMaximizedCapital(int k, int W, vector<int>& Profits, vector<int>& Capital) {\n        priority_queue<int>pq; // top ele
```\nclass Solution {\npublic:\n    int findMaximizedCapital(int k, int W, vector<int>& Profits, vector<int>& Capital) {\n        priority_queue<int>pq; // top element = max profit among all projects with Capital<=W; \n        vector<pair<int,int>>v; // to store index of projects\n        for(int i = 0;i<Capital.size();i++){\n            v.push_back({Capital[i],i});\n        }\n        sort(v.begin(),v.end());\n        int ans = W;\n        int j = 0;\n        while(k){\n            //push values\n            while(j<Capital.size() && v[j].first<=W){\n                pq.push(Profits[v[j].second]);// push all profits for which capital<=W\n                j++;\n            }\n            if(!pq.empty()){\n                ans+=pq.top();// take the max profit among them\n                W = W+pq.top();// new capital\n                pq.pop();\n               \n            }\n             k--;\n            \n        }\n        return ans;\n        \n    }\n};\n```
['C', 'Heap (Priority Queue)']