JAVA Solution Explained in HINDI
https://youtu.be/18FjKA210oM\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote 
https://youtu.be/18FjKA210oM\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote the solution if you liked it.\n\n# Subscribe:- [ReelCoding](https://www.youtube.com/@reelcoding?sub_confirmation=1)\n\nSubscribe Goal:- 500\nCurrent Subscriber:- 436\n\n# Complexity\n- Time complexity: O(nlogn+klogn)\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 {\n    public int findMaximizedCapital(int k, int w, int[] profits, int[] capital) {\n        int n = profits.length;\n        List<int[]> vp = new ArrayList<>();\n        for (int i = 0; i < n; i++) {\n            vp.add(new int[]{capital[i], profits[i]});\n        }\n        vp.sort((a, b) -> a[0] - b[0]);\n        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());\n\n        int totalProfit = w, j = 0;\n        for (int i = 0; i < k; i++) {\n            while (j < n && vp.get(j)[0] <= totalProfit) {\n                pq.offer(vp.get(j)[1]);\n                j++;\n            }\n\n            if (pq.isEmpty()) {\n                break;\n            }\n            totalProfit += pq.poll();\n        }\n\n        return totalProfit;\n    }\n}\n```
['Java']