FastPrepCoin Change II
Problems/Coin Change II

Coin Change II

Apple logoApple● MediumFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Apple full-time phone screen. The report names the exercise Coin Change II, with no custom twist. Our version is about 95% the same as the reported question.

The array coins contains different coin values. You have an unlimited supply of coins of each value. Count the combinations that sum to amount.

The order of the coins does not make a different combination: using coins 1,2,2 is the same combination as using 2,1,2. Return 0 when no combination exists. Amount 0 has one combination, the empty selection.

The requested count fits in a signed 32-bit integer.

Function

change(amount: int, coins: int[]) → int

Examples

Example 1

amount = 5coins = [1,2,5]return = 4

The amount can be made as [5], [2,2,1], [2,1,1,1], or [1,1,1,1,1]. No other combination works, so the answer counts these combinations.

Example 2

amount = 3coins = [2]return = 0

Every coin is worth 2, so any total you can build is even. The amount is odd, so there are no combinations at all.

Example 3

amount = 10coins = [10]return = 1

A single coin worth 10 makes the amount. That is the only combination, so the answer counts just this one.

Constraints

  • 1 <= coins.length <= 300.
  • All coin values are different, with 1 <= coins[i] <= 5000.
  • 0 <= amount <= 5000.
  • The answer is at most 2^31 - 1.

More Apple Phone Screen questions

  • Topological OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • LRU CachePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Merge IntervalsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Subarray Product Less Than KPHONE SCREEN · Seen Nov 2026
  • Evaluate DivisionPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Validate a BST with a Custom ComparisonPHONE SCREEN · Seen Nov 2026
  • Design a Food Rating SystemPHONE SCREEN · Seen Oct 2026
  • Days Until Poisoned Plants StabilizePHONE SCREEN · Seen Oct 2026
  • Capture Surrounded Regions with Union-FindPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Count Winning Electoral-State CoalitionsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Winning Draws for a Mahjong HandZip · PHONE SCREENZip interview questions
  • Count Strictly Increasing Subsequences of Length 3IBM · OAIBM interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Pressure-Isolation Shutdown OrderIntuit · OAIntuit interview questions
  • Count Good SubsequencesFlexport · OAFlexport interview questions
  • Sum of Compressed Number for All SubarraysWells Fargo · OAWells Fargo interview questions
  • Count Perfect BreaksAtlassian · OAAtlassian interview questions
  • Assign Escalations to TeamsAmazon · ONSITE INTERVIEW
  • Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions

Interview reports that mention this question

  • Apple India SWE New Grad Interviews: 5 Experiences
  • Apple New Grad SWE Phone Screens: 12 Experiences (Part 3 of 3)
  • Apple New Grad SWE Interviews: 37 Experiences (Part 1 of 3)

Apple interview experiences

  • Apple SWE Phone Screen: Subarray Products: 1 Experience
  • Apple New Grad SWE Java, Coding and Manager Rounds: 1 Experience
  • Apple AI Coding and Related Interviews: 17 Experiences
All Apple interview questionsSee Apple hiring insights
Saved
class Solution {
    public int change(int amount, int[] coins) {
        // Write your solution here.
    }

}
Checking account…