FastPrepMaximize Impression Value
Problems/Maximize Impression Value

Maximize Impression Value

InMobi logoInMobi● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an InMobi full-time online assessment. The report gives the full goal, the limits and a sample. Our version is about 99% the same as the reported question.

You are given n ad impressions. Each impression has a value and a cost (its floor price), and you have a fixed budget.

Select a subset of the impressions whose total cost does not exceed budget. Return the maximum possible sum of their values.

Each impression may be selected at most once.

Function

maximizeImpressionValue(values: int[], costs: int[], budget: int) → long

Examples

Example 1

values = [10,40,30,50]costs = [5,4,6,3]budget = 10return = 90

Select the second and fourth impressions. Their total cost is 4 + 3 = 7, and their total value is 40 + 50 = 90. No other valid subset has a larger total value.

Constraints

  • 1 <= values.length = costs.length <= 1000
  • 1 <= budget <= 10^5
  • 1 <= values[i] <= 10^9
  • 1 <= costs[i] <= 10^5

More InMobi Online Assessment questions

  • 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
  • Minimum Service Cold StartsOA · Seen Oct 2026
  • Range Maximum Subarray Sum QueriesOA · Seen Oct 2026
  • Connected Components with Divisor ThresholdOA · Seen Aug 2026
  • Supply Path OptimizationOA · Seen Aug 2026
  • Delivery ServiceOA · Seen Jun 2026
  • Shared InterestOA · Seen Jun 2026
  • Temporal AnomaliesOA · Seen Jun 2026

Similar questions at other companies

  • Card Game: Best First-Player ScoreShopify · OAShopify interview questions
  • Maximum Game Score with Fixed Forward JumpsStripe · OAStripe interview questions
  • 0/1 KnapsackConfluent · OAConfluent interview questions
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OAInfosys interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Lowest-Cost Shirt Color ScheduleElevenLabs · OAElevenLabs interview questions
  • Maximum Game Board ScoreJP Morgan Chase · OAJP Morgan Chase interview questions
  • API Bandwidth AllocationArista Networks · OAArista Networks interview questions
All InMobi interview questionsSee InMobi hiring insights
Saved
class Solution {
    public long maximizeImpressionValue(int[] values, int[] costs, int budget) {
        // write your code here
    }
}
Checking account…