The ATM Alchemist
HardAcc. 72.1%
+40 XP 20
The Perfect Sum
The ancient ATM only contains two types of bills: $20 and $50. Because of this limitation, it cannot dispense every possible amount of money.
The Challenge
Given an amount, determine if the machine can successfully provide that exact total using only combinations of $20 and $50 notes.
Examples
- $40: Yes (Two $20s)
- $50: Yes (One $50)
- $70: Yes (One $20 + One $50)
- $30: No (Impossible)
- $10: No (Impossible)
Your Task
Receive a number named amount. Return true if it can be dispensed, otherwise return false.
01EXAMPLE 1
Input
amount = 70Output
trueExplanation: 20 + 50 = 70
02EXAMPLE 2
Input
amount = 30Output
falseExplanation: No combination of 20 and 50 makes 30.
Constraints
- Amount is a non-negative integer.
- Return a boolean.
Control FlowMathLogic
JavaScriptSystem handles I/O — write your function only
Loading...
7 Hidden
Input Arguments
amount70
Expected Output
true
Click RUN to test your solution