Coin Change
Updated
Problem statement
You are given an array coins of distinct positive coin denominations and a nonnegative integer amount.
You have an unlimited supply of every denomination. Return the minimum number of coins needed to make exactly amount. If no combination can make the amount, return -1.
An amount of 0 requires 0 coins.
Function
coinChange(coins: int[], amount: int) → intExamples
Example 1
coins = [1,2,5]amount = 11return = 3Two coins of denomination 5 and one coin of denomination 1 make 11 with three coins.
Example 2
coins = [2]amount = 3return = -1No number of coins with denomination 2 can make the odd amount 3.
Example 3
coins = [1]amount = 0return = 0The empty selection makes amount 0.
Constraints
1 <= coins.length <= 12.1 <= coins[i] <= 2^31 - 1.- All denominations are distinct.
0 <= amount <= 10000.
More Bloomberg LP Onsite Interview questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Coin ChangeMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Path Through an O/X Grid Using Only Right and DownAmazon · PHONE SCREEN
- Coin ChangeKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Coin ChangePinterest · ONSITE INTERVIEWPinterest interview questions
- Fewest Jumps to the End or StuckAdobe · PHONE SCREENAdobe interview questions
- Coin ChangeGrubhub · PHONE SCREENGrubhub interview questions
- Largest Diamond of Ones in a GridRippling · PHONE SCREENRippling interview questions
- Minimum Jumps with Parity-Restricted Jump LengthsGoogle · ONSITE INTERVIEWGoogle interview questions
- Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions
- Number of IslandsIntuit · ONSITE INTERVIEWIntuit interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)