Pick At Most K Growth Experiments to Maximize Final Team Budget
Last updated: November 29, 2026
Quick Overview
A Lemon8 growth team starts with budget W; each experiment needs a minimum budget to launch and returns a pure gain when done, one at a time, and each can run once; return the largest budget after at most k experiments.
ByteDance
November 29, 20260
0
0 solved
A Lemon8 growth team starts with budget W; each experiment needs a minimum budget to launch and returns a pure gain when done, one at a time, and each can run once; return the largest budget after at most k experiments.
Lemon8 is one of ByteDance's newer apps, and resource-gated choices like this map to heap questions common in ByteDance screens. The interviewer checks that you combine sorting by requirement with a max-heap of unlocked gains and can argue why greedy is optimal.
What the Interviewer Expects
- Sort experiments by required budget
- Push newly affordable experiments into a max-heap of gains
- Always run the largest available gain
- Stop early when nothing is affordable
- Prove the greedy choice with an exchange argument
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Experiments can run in parallel up to c at a time.
- Some experiments have negative expected gain with variance: how would you decide?
- k is huge but n is small: optimize the loop bound.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: k, starting budget W, and arrays costs and gains of length n. An experiment is launchable if its cost is at most the current budget; the cost is a threshold, not spent, and its gain is added wh...
High-Level Design
Gains only increase the budget, so the set of launchable experiments only grows. At each step, running the largest launchable gain is never worse: any other choice leaves a smaller budget, which unloc...