Skip to content

Commit dc9c853

Browse files
committed
commit
1 parent 7539989 commit dc9c853

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int accountBalanceAfterPurchase(int amt) {
3+
// Base case
4+
if (amt % 10 == 0) {
5+
return 100-amt;
6+
}
7+
8+
int ans = 100-amt;
9+
10+
return (amt % 10 >= 5) ? (ans / 10) * 10 : ((ans / 10) + 1) * 10;
11+
}
12+
}

0 commit comments

Comments
 (0)