Mere jaise dimag wale logo ke liye easy hindi solution!!
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nInput Processing:\nPehl
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nInput Processing:\nPehle, profits aur capital ke basis pe ek 2D array arr banate hain jahan har sub-array mein capital aur profit ka pair hota hai.\n\nSorting:\nUske baad, arr ko capital (capital) ke basis pe ascending order mein sort kiya jata hai taaki hum kam se kam capital wale projects ko pehle process kar sakein.\n\nPriority Queue:\nEk max-heap (PriorityQueue) pq banai jati hai jo maximum profit (profits) ko priority deti hai.\n\nMain Loop:\nk bar loop chalta hai, har bar hum un projects ko pq mein add karte hain jinki capital w se kam ya barabar hai.\n\nAdd Profit:\nAgar pq empty nahi hai, to iska matlab hai ki humare paas ek aisa project hai jo hum kar sakte hain. Hum us project ke profit ko w mein add karte hain.\nAgar pq empty ho jati hai, to iska matlab hai ki ab koi bhi project nahi hai jo hum kar sakte hain, isliye hum loop se bahar aa jate hain.\n\nResult:\nAnt mein, maximum capital w ko return karte hain.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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        int[][] arr = new int[n][2];\n        for(int i=0 ; i<n ; i++){\n            arr[i][0] = capital[i];\n            arr[i][1] = profits[i];\n        }\n\n        Arrays.sort(arr, (a,b) -> Integer.compare(a[0],b[0]));\n        int i = 0;\n\n        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());\n\n        while(k-- > 0){\n            while(i < n && arr[i][0] <= w){\n                pq.offer(arr[i][1]);\n                i++;\n            }\n            if(pq.isEmpty()){\n                break;\n            }\n            w += pq.poll();\n        }\n        return w;\n    }\n}\n```
['Heap (Priority Queue)', 'Java']