Skip to main content
LeetCode 1716, Easy. Topics: Math. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 31 parametrized pytest cases, and a playground notebook:

Problem

Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. Given n, return the total amount of money he will have in the Leetcode bank at the end of the n^th day.

Examples

Constraints

  • 1 <= n <= 1000

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026