Pick Launches to Maximize Capital With at Most K Projects

Last updated: November 29, 2026

Quick Overview

Each project needs a minimum capital to start and returns a pure profit added to your capital. Starting with capital w, you may complete at most k projects one after another. Return the maximum final capital.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Each project needs a minimum capital to start and returns a pure profit added to your capital. Starting with capital w, you may complete at most k projects one after another. Return the maximum final capital.

A Google onsite greedy question in a product-launch funding frame, often used to test the two-heap unlock pattern. The interviewer wants projects sorted by required capital and a max-heap of profits for everything currently affordable.

What the Interviewer Expects
  • Sorts projects by required capital
  • Unlocks affordable projects into a max-heap of profits
  • Picks the largest profit each round
  • Stops early when nothing is affordable
  • Justifies greedy since capital only grows
Key Topics to Cover
Max-Heap
Greedy
Sorting
Two Heaps
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • What if projects can lose money?
  • What if projects run in parallel with a team limit?
  • Return the chosen projects
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: k, initial capital w, lists profits and capital of length n.
  • A project is startable when current capital >= its requirement; finishing adds its profit (non-negative).
  • Output: maximum ...
High-Level Design

Profits are non-negative, so capital never decreases, and any project affordable now stays affordable. That makes the greedy clean: at each step, among all affordable projects, take the one with the l...


Submit Your Answer
Markdown supported