Skip to content

Commit

Permalink
Create account-balance-after-rounded-purchase.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Aug 7, 2023
1 parent 570f827 commit 076644c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions C++/account-balance-after-rounded-purchase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Time: O(1)
// Space: O(1)

// math
class Solution {
public:
int accountBalanceAfterPurchase(int purchaseAmount) {
return 100 - (purchaseAmount + 5) / 10 * 10;
}
};

0 comments on commit 076644c

Please sign in to comment.