FastPrepFind Minimum Price to Spend
Problems/Find Minimum Price to Spend

Find Minimum Price to Spend

PayPal logoPayPal● MediumOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Given an array price[1-n] and m (discount), find the minimum price to spend to buy all the items.

Use the following formula to apply the coupon: price[i] / 2^x, where x is the number of coupons used, and i is the index of the item in the array.

Function

findMinimumPriceToSpend(price: int[], m: int) → int

Complete the function findMinimumPriceToSpend in the editor.

findMinimumPriceToSpend has the following parameters:

  1. 1. int[] price: an array of integers representing the price of each item
  2. 2. int m: the number of discounts available

Returns int: the minimum price to spend

Examples

Example 1

price = [1, 2, 3]m = 2return = 3

🦦

Constraints

  • 🦦

More PayPal interview questions

  • Minimum Cost to Merge Values into OneOA · Seen Nov 2026
  • Per-User Sliding-Window Rate LimiterOA · Seen Nov 2026
  • Total Cost Against the Lowest Earlier PriceOA · Seen Nov 2026
  • Can the Singer Perform the Song?PHONE SCREEN · Seen Jul 2025
  • Items Purchase (For Java Backend Engineer)OA · Seen Nov 2024
  • Modify ArrayOA · Seen Jun 2024
  • Count User Logins 🌿 (Singapore)OA · Seen Mar 2024
  • Similar Password 🪴 (Singapore)OA · Seen Mar 2024

Similar questions at other companies

  • Task SchedulerAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum K-Star SumC3.ai · OAC3.ai interview questions
  • Maximum Sum of a K-StarMicrosoft · OAMicrosoft interview questions
  • Maximum ScoreNVIDIA · OANVIDIA interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Decreasing SubsequencesGoogle · OAGoogle interview questions
  • Get Maximum AmountIBM · OAIBM interview questions
  • Optimize TikTok Reels ViewingTikTok · OATikTok interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions

PayPal interview experiences

  • PayPal SWE Intern OA Questions: 1 Experience
All PayPal interview questionsSee PayPal hiring insights
Saved
class Solution {
    public int findMinimumPriceToSpend(int[] price, int m) {
      // write your code here
    }

}
Checking account…