FunctionRacerProblemsRace

Money in the Bank

EasyMathPython, JavaScript, TypeScript, Java, C++

You save money every day for n days. On the first Monday you put in 1 dollar and each following day of that week 1 dollar more than the day before (Tuesday 2, ..., Sunday 7). Every new Monday you put in 1 dollar more than the previous Monday. Day 1 is a Monday. Return the total saved after n days.

Example 1

n 10
returns 37

28 for week one, then 2 + 3 + 4 = 9: 37.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems