Practice Account Balance After Rounded Purchase
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Start with a balance of 100 dollars. Round purchaseAmount to the nearest multiple of 10, choosing the larger multiple for a tie at 5, 15, 25 and so on. Zero counts as a multiple of 10. Subtract the rounded amount and return the remaining balance.
Source: Account Balance After Rounded Purchase on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
purchaseAmount = 9
Output
90
# Example 2
Input
purchaseAmount = 15
Output
80
# Example 3
Input
purchaseAmount = 10
Output
90
Constraints
0 <= purchaseAmount <= 100
Related LeetCode Problems
Practice more problems similar to Account Balance After Rounded Purchase.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.