Coin Change II
Updated
Problem statement
You are given an array coins of different coin values, all positive, and a target amount that is zero or more. Return how many different ways you can pick coins that add up to exactly amount.
You may use each coin value as many times as you like. Order does not matter: the same coins picked in a different order count as one way.
Function
countCoinChangeCombinations(coins: int[], amount: int) → longExamples
Example 1
coins = [1,2,5]amount = 5return = 4The ways to make the amount are: 5 alone, 2+2+1, 2+1+1+1, and five 1s. That is four ways.
Example 2
coins = [2]amount = 3return = 0No number of 2s sums to 3.
Constraints
1 <= coins.length <= 100.1 <= coins[i] <= 5000and all coin values are different.0 <= amount <= 5000.- The answer fits in a signed 64-bit integer.
More Bloomberg LP Phone Screen questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Maximum Sum with K-Element SkippingPhonePe · ONSITE INTERVIEWPhonePe interview questions
- Assign Escalations to TeamsAmazon · ONSITE INTERVIEW
- Count Complete Tic-Tac-Toe GamesDecagon · PHONE SCREEN · ONSITE INTERVIEWDecagon interview questions
- Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions
- Distinct Subset SumsGoogle · ONSITE INTERVIEWGoogle interview questions
- Maximum Product of a Contiguous SubarrayLinkedIn · PHONE SCREENLinkedIn interview questions
- Count Subsets With a Target SumSafe Security · ONSITE INTERVIEW
- House Robber IIIOkta · PHONE SCREENOkta interview questions
- Minimum Coins for a TargetInfosys · ONSITE INTERVIEWInfosys interview questions
- All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll 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)