Here is the solution:
function findMaximizedCapital(k, W, profits, capital)
projects := list of (capital[i], profits[i])
sort projects by capital ascending
availableHeap := max-heap by profit
i := 0
for round from 1 to k
while i < n and projects[i].capital <= W
availableHeap.push(projects[i].profit)
i := i + 1
if availableHeap is empty then
break
W := W + availableHeap.pop()
return W
Time: for sorting and heap operations. Space: .
Each round, add all affordable projects, then take the most profitable.