java.lang.Object
g1701_1800.s1716_calculate_money_in_leetcode_bank.Solution

public class Solution extends Object
1716 - Calculate Money in Leetcode Bank.<p>Easy</p> <p>Hercy wants to save money for his first car. He puts money in the Leetcode bank <strong>every day</strong>.</p> <p>He starts by putting in <code>$1</code> on Monday, the first day. Every day from Tuesday to Sunday, he will put in <code>$1</code> more than the day before. On every subsequent Monday, he will put in <code>$1</code> more than the <strong>previous Monday</strong>.</p> <p>Given <code>n</code>, return <em>the total amount of money he will have in the Leetcode bank at the end of the</em> <code>n<sup>th</sup></code> <em>day.</em></p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> n = 4</p> <p><strong>Output:</strong> 10</p> <p><strong>Explanation:</strong> After the 4<sup>th</sup> day, the total is 1 + 2 + 3 + 4 = 10.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> n = 10</p> <p><strong>Output:</strong> 37</p> <p><strong>Explanation:</strong> After the 10<sup>th</sup> day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4) = 37. Notice that on the 2<sup>nd</sup> Monday, Hercy only puts in $2.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> n = 20</p> <p><strong>Output:</strong> 96</p> <p><strong>Explanation:</strong> After the 20<sup>th</sup> day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4 + 5 + 6 + 7 + 8) + (3 + 4 + 5 + 6 + 7 + 8) = 96.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= n <= 1000</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • totalMoney

      public int totalMoney(int n)