Tap here to switch tabs
Problem
Submissions

Problem: Library Late Fee Calculator

Library Late Fee Calculator totals penalties from an array of overdue days. Use one per day for one-day delays, two per day through five days, and three per day thereafter.

Statement

You are given an integer array daysLate, where daysLate[i] denotes the number of days the ithi^{ {th}} book is overdue.

The penalty for each book is calculated as follows:

  • If daysLate[i] is equal to 11, the penalty is 1×1 \times daysLate[i].

  • If daysLate[i] is between 22 and 55 inclusive, the penalty is 2×2 \times daysLate[i].

  • If daysLate[i] is strictly greater than 55, the penalty is 3×3 \times daysLate[i].

Return the total penalty for all overdue books.

Constraints:

  • 1≤1 \leq daysLate.length ≤100\leq 100

  • 1≤1 \leq daysLate[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Library Late Fee Calculator

Library Late Fee Calculator totals penalties from an array of overdue days. Use one per day for one-day delays, two per day through five days, and three per day thereafter.

Statement

You are given an integer array daysLate, where daysLate[i] denotes the number of days the ithi^{ {th}} book is overdue.

The penalty for each book is calculated as follows:

  • If daysLate[i] is equal to 11, the penalty is 1×1 \times daysLate[i].

  • If daysLate[i] is between 22 and 55 inclusive, the penalty is 2×2 \times daysLate[i].

  • If daysLate[i] is strictly greater than 55, the penalty is 3×3 \times daysLate[i].

Return the total penalty for all overdue books.

Constraints:

  • 1≤1 \leq daysLate.length ≤100\leq 100

  • 1≤1 \leq daysLate[i] ≤100\leq 100