FastPrepCredit Card Monthly Statement
Problems/Credit Card Monthly Statement

Credit Card Monthly Statement

Capital One logoCapital One● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A June 2016 report from a Capital One applications developer candidate recalls an hour of the onsite day, a job-fit session, spent on a credit card statement task in Java, and says the time felt too tight for what was expected.

The report gives no inputs, formulas or layout. Here the statement is worked out from the opening balance, a credit limit, a monthly interest rate and a list of purchases and payments in order, and it returns the purchases and payments totals, the number of declined purchases, the interest, the new balance and the minimum due. Every rate, threshold and rounding rule is a practice choice.

The judged task matches the report at about 50%.

Work out one monthly credit card statement. All money is in whole cents. You get the balance the month opened with, previousBalance, the card's creditLimit, the interest rate for the month in hundredths of a percent, monthlyRate (150 means 1.5%), and the month's transactions in the order they happened. Each transaction is "PURCHASE amount" or "PAYMENT amount".

Keep a running balance that starts at previousBalance:

  • A purchase is approved only if the running balance after adding it is at most creditLimit; then it is added. Otherwise the purchase is refused: it counts as declined and the balance stays as it was.
  • A payment is always taken and lowers the running balance. The balance may go below zero, which is a credit.

After the last transaction:

  • Interest is 0 if the payments of the month add up to at least previousBalance. Otherwise it is previousBalance * monthlyRate / 10000 rounded down.
  • The new balance is the running balance plus the interest.
  • The minimum due is 0 if the new balance is not above zero. Otherwise it is 1% of the new balance, rounded down, plus the interest, but at least 2500, and never more than the new balance.

Return six integers in this order: the total of the approved purchases, the total of the payments, the number of declined purchases, the interest, the new balance, and the minimum due.

Function

buildStatement(previousBalance: int, creditLimit: int, monthlyRate: int, transactions: String[]) → int[]

Examples

Example 1

previousBalance = 123457creditLimit = 200000monthlyRate = 150transactions = ["PURCHASE 30000","PAYMENT 20000","PURCHASE 90000","PURCHASE 60000"]return = [90000,20000,1,1851,195308,3804]

The balance climbs from 123457 to 153457, falls to 133457 after the payment, and the purchase of 90000 would reach 223457, above the limit, so that purchase is refused and nothing is added. The purchase of 60000 then fits and the balance is 193457, so purchases total 90000. Payments 20000 are below the opening balance, so interest applies: 123457 * 150 / 10000 = 1851.855, rounded down to 1851. The new balance is 193457 + 1851 = 195308. Its 1% rounded down is 1953, plus the interest 3804, which is above 2500 and below the balance, so that is the minimum due.

Example 2

previousBalance = 30000creditLimit = 60000monthlyRate = 200transactions = ["PAYMENT 30000","PURCHASE 40000"]return = [40000,30000,0,0,40000,2500]

The payment of 30000 equals the opening balance, which pays it off, so no interest is charged. The balance goes to 0 and then to 40000. 1% of it is 400, below the floor, so the minimum due is 2500.

Example 3

previousBalance = 0creditLimit = 5000monthlyRate = 100transactions = ["PURCHASE 5000","PURCHASE 100","PAYMENT 3000"]return = [5000,3000,1,0,2000,2000]

The purchase of 5000 brings the balance exactly to the limit, which is allowed. The purchase of 100 would pass the limit, so it is refused and counted as declined. Once 3000 is paid in, the new balance is 2000. The minimum due would be 2500, but it is never more than the balance, so it is 2000. The opening balance was 0, so there is no interest.

Example 4

previousBalance = 8000creditLimit = 20000monthlyRate = 300transactions = ["PAYMENT 12000"]return = [0,12000,0,0,-4000,0]

The payment of 12000 exceeds the opening balance of 8000, so there is no interest and the account ends with a credit of 4000: the new balance is -4000. A balance that is not positive has no minimum due, so it is 0.

Constraints

  • 0 <= transactions.length <= 1000
  • Each transaction is "PURCHASE amount" or "PAYMENT amount" with a single space and a whole number amount from 1 to 100000.
  • 1 <= creditLimit <= 500000 and 0 <= previousBalance <= creditLimit
  • 0 <= monthlyRate <= 300

More Capital One Onsite Interview questions

  • Digit-Coded Card ValidationONSITE INTERVIEW · Seen Nov 2026
  • Sort ColorsONSITE INTERVIEW · Seen Oct 2026
  • Virtual Card Transaction ValidatorONSITE INTERVIEW · Seen Oct 2026
  • Banking System with Top ActivityONSITE INTERVIEW · Seen Sep 2026
  • Transaction Event StoreONSITE INTERVIEW · Seen Jul 2026
  • Shortest Path in an Unweighted GraphONSITE INTERVIEW · Seen Jul 2026
  • Duplicate Transactions Within 60 SecondsONSITE INTERVIEW · Seen May 2026
  • LRU CachePHONE SCREEN · ONSITE INTERVIEW · Seen May 2026
  • Cashback TrackerONSITE INTERVIEW · Seen Nov 2025
  • Reverse a StringOA · ONSITE INTERVIEW · Seen Oct 2025

Similar questions at other companies

  • Babysitter Quote with Hourly RatesUpstart · ONSITE INTERVIEWUpstart interview questions
  • Expected Value of Modified DiceJane Street · ONSITE INTERVIEWJane Street interview questions
  • Fractional Share Inventory FlatteningRobinhood · PHONE SCREEN · ONSITE INTERVIEWRobinhood interview questions
  • Reservoir Sampling with Recorded DrawsMeta · ONSITE INTERVIEWMeta interview questions
  • Group-Relative Policy AdvantagesAmazon · ONSITE INTERVIEW
  • Reservoir Sampling with Recorded DrawsStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • Iterate Canonical IPv6 AddressesOpenAI · ONSITE INTERVIEWOpenAI interview questions
  • Nth Staged License PlateGoogle · ONSITE INTERVIEWGoogle interview questions
  • UCB1 Multi-Armed Bandit TraceWayfair · ONSITE INTERVIEWWayfair interview questions
  • Rasterize a Circle with Integer PixelsPure Storage · ONSITE INTERVIEWPure Storage interview questions

Capital One interview experiences

  • Capital One Coding OA Questions: 3 Experiences
  • Capital One Experienced Engineer Power Day and OA: 6 Experiences
  • Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
  • Capital One TDP Agentic Round (AI Coding): 7 Experiences
  • Capital One SWE Power Day, Level Not Reported: 6 Experiences
  • Capital One TIP Intern OA and Power Day: 13 Experiences
All Capital One interview questionsSee Capital One hiring insights
Saved
class Solution {
    public int[] buildStatement(int previousBalance, int creditLimit, int monthlyRate, String[] transactions) {
        // Write your code here.
    }
}
Checking account…