IPO
Updated
Problem statement
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[]) → intExamples
Example 1
k = 2w = 0profits = [1,2,3]capital = [0,1,1]return = 4Start 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 = 0No 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^51 <= k <= profits.length0 <= w <= 10^90 <= profits[i] <= 10^90 <= capital[i] <= 10^9- The maximum final capital fits in a signed
32-bit integer.
More InMobi Phone Screen questions
- House Robber IPHONE SCREEN · Seen Aug 2026
- Word Break IIPHONE SCREEN · Seen Aug 2026
- Bus Station Seat AllotmentPHONE SCREEN · Seen Mar 2026
- Find Missing and Duplicate IntegerPHONE SCREEN · Seen Mar 2026
- Frequency Equals Card ValuePHONE SCREEN · Seen Mar 2026
- Frog Position After T SecondsPHONE SCREEN · Seen Mar 2026
- Evaluate DivisionPHONE SCREEN · Seen Dec 2025
- Compare Version NumbersPHONE SCREEN · Seen Feb 2022
- Count Array DerangementsPHONE SCREEN · Seen Feb 2022
- Maximum Frequency StackPHONE SCREEN · Seen Feb 2022
Similar questions at other companies
- IPOTekion · PHONE SCREENTekion interview questions
- Lexicographically Smallest Array with K-Limited Right MovesGoogle · PHONE SCREENGoogle interview questions
- Minimum Refueling StopsBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
- Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
- Schedule Unit-Time Jobs for the Most ProfitScale AI · PHONE SCREENScale AI interview questions
- Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
- Minimum Refueling StopsUber · ONSITE INTERVIEWUber interview questions
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions