diff --git a/1716. Calculate Money in Leetcode Bank 1 b/1716. Calculate Money in Leetcode Bank 1 new file mode 100644 index 0000000..8f6d221 --- /dev/null +++ b/1716. Calculate Money in Leetcode Bank 1 @@ -0,0 +1,17 @@ +class Solution { +public: + int totalMoney(int n) { + int sum = 0, i = 1, j = 0; + for(int cnt = 1; cnt <= n; ++cnt) + { + sum += i; + i++; + if(i > 7+j) + { + j++; + i = 1 + j; + } + } + return sum; + } +};