← Snowflake Interview Insights

Snowflake·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Snowflake software engineer interview with a coin exchange problem that looks like a greedy question but has a twist that trips you up if you're not careful.

Questions Asked (1)

Q1

You have unlimited coins in denominations [1, 5, 10, 50, 100, 200]. To pay an amount n, you can overpay and receive change back using the same denominations. What is the minimum total number of coins exchanged in both directions combined?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Saw 'coins' and immediately started thinking greedy, which is the wrong instinct here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Recognize this as a coin change problem with overpayment allowed, which can be modeled as finding the minimum number of coins to represent n plus some overpayment amount, where the change is also given in the same denominations. Use dynamic programming to compute the minimum coins for all amounts up to a reasonable bound, then for each n, consider overpaying up to that bound and add the coins for the change. Alternatively, derive a greedy strategy by analyzing the denominations and proving that the optimal solution uses at most one coin of each denomination in the change, leading to a simple formula.

Pro tip: Demonstrate maturity by discussing the trade-offs between a brute-force DP solution and a more elegant greedy approach, and mention that the greedy approach works because the denominations are canonical (each is a multiple of the previous).

1. Understand the problem

Clarify that you can pay any amount ≥ n, and the change is returned using the same coin denominations. The goal is to minimize the total number of coins used in payment plus change.

2. Model as coin change with overpayment

For a given n, consider all possible overpayment amounts m ≥ n, and compute the minimum coins to make m plus the minimum coins to make m - n. The answer is the minimum over m.

3. Choose an algorithm

Use dynamic programming to compute min coins for all amounts up to a bound (e.g., n + 200). Alternatively, exploit the canonical coin system to derive a greedy formula.

4. Optimize and analyze

If using DP, note that the bound can be limited because overpaying more than the largest denomination is never beneficial. If using greedy, prove that the optimal solution uses at most one coin of each denomination in the change.

5. Test and validate

Test with small examples (e.g., n=3, n=8, n=99) to verify the approach and ensure edge cases are handled.

Key Points to Mention

  • Dynamic programming approach: dp[i] = min coins to make amount i, then answer = min_{m≥n} (dp[m] + dp[m-n]).
  • Bound on overpayment: never need to overpay more than the largest coin (200) because you can always adjust.
  • Greedy strategy: for canonical coin systems, the optimal payment uses the greedy algorithm, and the change also uses greedy, but need to consider overpaying to reduce total coins.
  • Mathematical insight: the optimal solution uses at most one coin of each denomination in the change, leading to a formula based on the digits of n in the mixed-radix system.
  • Time complexity: O(n) with DP, but can be O(1) with the greedy formula.
  • Trade-offs: DP is simpler to implement and reason about, but greedy is more efficient and elegant if proven correct.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.