Loading...

The Coin Vault

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
mid, senior

Problem

A payment processing system needs to calculate the minimum number of bills or coins required to make exact change for a given amount. Given a target amount and a list of coin denominations sorted in any order, return the minimum number of coins needed to sum to the amount using a greedy strategy. Return -1 if exact change cannot be made.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.