FastPrepAnnual Bank Balance with Monthly Card Fees
Problems/Annual Bank Balance with Monthly Card Fees

Annual Bank Balance with Monthly Card Fees

Deloitte logoDeloitte● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Deloitte online assessment. The report leaves out how the sign of a transaction works, what an empty month means, and the input limits. Our version is about 92% the same as the reported question.

You are given two parallel arrays that describe every transaction made by one bank account during a calendar year:

  • transactions[i] is the signed amount of transaction i. A positive amount is money received, while a negative amount is a card payment.
  • dates[i] is the transaction date in YYYY-MM-DD format. All dates belong to the same calendar year.

Every transaction amount contributes directly to the balance. The account normally pays a fee of 5 for each of the twelve months, including a month with no transactions.

A month's fee is waived only when that month contains at least three card payments and the sum of their absolute values is at least 100.

Starting from balance 0, return the final balance after all transactions and all applicable monthly fees.

Function

annualAccountBalance(transactions: int[], dates: String[]) → int

Examples

Example 1

transactions = [100,-30,-40,-30]dates = ["2022-01-01","2022-01-10","2022-01-20","2022-01-30"]return = -55

The transactions sum to 0. January has three card payments totaling 100, so its fee is waived. The other eleven monthly fees total 55.

Example 2

transactions = [100]dates = ["2022-12-01"]return = 40

No month qualifies for a waiver, so all twelve fees total 60. Subtracting them from the transaction total of 100 gives 40.

Example 3

transactions = [-25,-25,-50,120]dates = ["2022-02-01","2022-02-02","2022-02-03","2022-07-01"]return = -35

The transactions sum to 20. February qualifies for a waiver, while the other eleven months contribute 55 in fees, so the final balance is 20 - 55 = -35.

Constraints

  • transactions.length == dates.length.
  • 0 <= transactions.length <= 100,000.
  • -1,000,000 <= transactions[i] <= 1,000,000.
  • Every value in dates is a valid date in one calendar year using YYYY-MM-DD format.

More Deloitte Online Assessment questions

  • Seventh Nearest PalindromeOA · Seen May 2026
  • Minimum Deletions for a Non-PalindromeOA · Seen Jul 2025
  • Minimum-Cost Solar Rooftop AllocationOA · Seen Jul 2025
  • Pair Elements with Even SumsOA · Seen Jul 2025
  • Count Divisible PermutationsOA · Seen Jan 2025
  • Largest Element in an ArrayOA · Seen Nov 2024
  • Install Carbon FiltersOA · Seen Oct 2023
  • Longest Substring with Even OccurrencesOA · Seen Oct 2023
  • Maximum Sum RectangleOA · Seen Apr 2022
  • Count Battleships by SizeOA · Seen Jan 2022

Similar questions at other companies

  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • Costliest ChocolateRippling · OARippling interview questions
  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Plus Mult ArrayIBM · OAIBM interview questions
  • Progressive Tax CalculatorInteractive Brokers · OA
  • 2020 Account Balance with Monthly Card FeesDRW · OADRW interview questions
  • Array Challenge (QR Intern)Akuna Capital · OAAkuna Capital interview questions
  • Latency Bucket CounterDatadog · OA · PHONE SCREENDatadog interview questions
  • First Fibonacci Number at Least the Array SumBitGo · OABitGo interview questions

Deloitte interview experiences

  • Deloitte New Grad Tech OA and Interview Questions: 14 Experiences
All Deloitte interview questionsSee Deloitte hiring insights
Saved
class Solution {
    public int annualAccountBalance(int[] transactions, String[] dates) {
        // Write your code here.
    }
}
Checking account…