FastPrepIPO
Problems/IPO

IPO

InMobi logoInMobi● HardFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source provides the IPO objective and capital-update rule but no examples, callable interface, or numeric bounds. The judged core follows the canonical IPO task and matches the visible source at about 94%.

You are given n projects. Project i produces a pure profit of profits[i] and requires at least capital[i] current capital before it can be started.

You begin with capital w. After completing a project, immediately add its profit to your capital. Each project may be completed at most once.

Choose at most k distinct projects to maximize your final capital. Return that maximum final capital.

Function

findMaximizedCapital(k: int, w: int, profits: int[], capital: int[]) → int

Examples

Example 1

k = 2w = 0profits = [1,2,3]capital = [0,1,1]return = 4

Start project 0 to grow the capital from 0 to 1. Projects 1 and 2 then become affordable; choosing project 2 produces final capital 4.

Example 2

k = 3w = 0profits = [1,2,3]capital = [1,1,2]return = 0

No project is affordable with initial capital 0, so no project can be completed and the final capital remains 0.

Constraints

  • 1 <= profits.length = capital.length <= 10^5
  • 1 <= k <= profits.length
  • 0 <= w <= 10^9
  • 0 <= profits[i] <= 10^9
  • 0 <= capital[i] <= 10^9
  • The maximum final capital fits in a signed 32-bit integer.

More InMobi problems

  • Validate a Bracket SequenceOA · Seen Oct 2026
  • Count Substrings Matching with One Adjacent SwapOA · Seen Oct 2026
  • Maximum Subarray with Start and End WindowsOA · Seen Oct 2026
All InMobi interview questionsSee InMobi hiring insights
Saved
public int findMaximizedCapital(int k, int w, int[] profits, int[] capital) {
    // Write your code here
}
Checking account…