Skip to content

Commit 1ad8ef4

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 39.1 MB (Top 94.89%)
1 parent 71566c7 commit 1ad8ef4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/algorithms/C/Calculate Money in Leetcode Bank/Calculate Money in Leetcode Bank.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 39.1 MB (Top 94.89%)
12
class Solution {
23
public int totalMoney(int n) {
3-
int m=n/7; //(no.of full weeks)
4-
// first week 1 2 3 4 5 6 7 (sum is 28 i.e. 7*(i+3) if i=1)
5-
// second week 2 3 4 5 6 7 8 (sum is 35 i.e. 7*(i+3) if i=2)
4+
int m=n/7; //(no.of full weeks)
5+
// first week 1 2 3 4 5 6 7 (sum is 28 i.e. 7*(i+3) if i=1)
6+
// second week 2 3 4 5 6 7 8 (sum is 35 i.e. 7*(i+3) if i=2)
67
//.... so on
78
int res=0; //for result
89
//calculating full weeks
@@ -15,4 +16,4 @@ public int totalMoney(int n) {
1516
}
1617
return res;
1718
}
18-
}
19+
}

0 commit comments

Comments
 (0)