Choosing Greedily !
 # Intuition  \n\n\n\n\n\n# Complexity\n- Time complexity: O((n + k) log (n)) = O(nlogn)\n\n\n- Space complexity: O(n)\n\n\n# Code\n\nclass Solution {\npublic:\
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n<!-- # Approach -->\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O((n + k) log (n))$$ = $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int findMaximizedCapital(int k, int w, vector<int>& profits, vector<int>& capital) {\n        int n = profits.size();\n        vector<pair<int, int>> ipo(n);\n        for(int i = 0; i < n; i++)\n            ipo[i] = make_pair(capital[i], profits[i]);\n        sort(ipo.begin(), ipo.end());\n        priority_queue<int> pq;\n        int i = 0;\n        while(k--) {\n            while(i < n && ipo[i].first <= w)\n                pq.push(ipo[i++].second);\n            if(pq.empty())\n                break;\n            w += pq.top();\n            pq.pop();\n        }\n        return w;\n    }\n};\n```
['Sorting', 'Heap (Priority Queue)', 'C++']