FastPrepDuplicate Transactions Within 60 Seconds
Problems/Duplicate Transactions Within 60 Seconds

Duplicate Transactions Within 60 Seconds

Capital One logoCapital One● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2026 report on a Capital One software engineer interview says one of the technical rounds asked how to find duplicate transactions in a stream when they fall within 60 seconds of each other.

The report does not say what makes two transactions the same, whether exactly 60 seconds counts, or what to return. Here, two transactions match when the account, merchant and amount are all equal. A transaction is a duplicate when an earlier match, which may itself be a duplicate, came at most 60 seconds before it, and you return the duplicate indices in order. You get the stream as four arrays already in time order, with up to 10^4 transactions.

Our version is about 70% the same as the reported question.

A card system receives a stream of transactions in time order. Transaction i happened at second timestamps[i], on account accounts[i], at merchant merchants[i], for amounts[i] cents.

Transaction j is a duplicate if some earlier transaction i (with i < j) has:

  • the same account, the same merchant and the same amount, and
  • timestamps[j] - timestamps[i] <= 60.

The earlier transaction can itself be a duplicate. Two transactions in the same second also count, since their difference is 0.

Return the indices of all duplicate transactions in increasing order. Return an empty array if there are none.

Function

findDuplicateTransactions(timestamps: int[], accounts: String[], merchants: String[], amounts: int[]) → int[]

Examples

Example 1

timestamps = [0,20,45,70,200]accounts = ["a1","a1","a1","b2","a1"]merchants = ["shop","shop","cafe","shop","shop"]amounts = [500,500,500,500,500]return = [1]
  • Transaction 1 matches transaction 0 (account a1, merchant shop, 500 cents) and comes 20 seconds later, so it is a duplicate.
  • Transaction 2 is at a different merchant, and transaction 3 is on a different account.
  • Transaction 4 matches transactions 0 and 1, but the closer one, transaction 1, is 180 seconds earlier. It is not a duplicate.

Example 2

timestamps = [100,160,220,281]accounts = ["c3","c3","c3","c3"]merchants = ["gas","gas","gas","gas"]amounts = [4000,4000,4000,4000]return = [1,2]
  • Transaction 1 comes exactly 60 seconds after transaction 0. That still counts, so it is a duplicate.
  • Transaction 2 is 120 seconds after transaction 0, but only 60 seconds after transaction 1, so it is a duplicate too.
  • Transaction 3 is 61 seconds after transaction 2, its nearest match, so it is not a duplicate.

Example 3

timestamps = [5,5,9]accounts = ["x","x","x"]merchants = ["m","m","m"]amounts = [100,250,100]return = [2]
  • Transactions 0 and 1 happen in the same second, but their amounts differ.
  • Transaction 2 matches transaction 0 and comes 4 seconds later, so the answer is [2].

Constraints

  • 1 <= timestamps.length <= 10^4
  • accounts.length == merchants.length == amounts.length == timestamps.length
  • 0 <= timestamps[i] <= 10^9
  • timestamps[i - 1] <= timestamps[i] for every i >= 1
  • 1 <= accounts[i].length, merchants[i].length <= 10
  • accounts[i] and merchants[i] contain only lowercase English letters and digits.
  • 1 <= amounts[i] <= 10^6

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
  • LRU CachePHONE SCREEN · ONSITE INTERVIEW · Seen May 2026
  • Cashback TrackerONSITE INTERVIEW · Seen Nov 2025
  • Reverse a StringOA · ONSITE INTERVIEW · Seen Oct 2025
  • Most Cost-Effective MachineONSITE INTERVIEW · Seen Sep 2025

Similar questions at other companies

  • Shortest Window with Required CountsOracle · ONSITE INTERVIEWOracle interview questions
  • Count Zero Request ServersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Sliding Window Median of Response TimesGoogle · ONSITE INTERVIEWGoogle interview questions
  • Longest Subarray with K Distinct ValuesAmazon · ONSITE INTERVIEW
  • Count Equal Code Pairs Within Distance KInfosys · ONSITE INTERVIEWInfosys interview questions
  • Longest Subarray with At Most Two Distinct ValuesMoody's Investors Service · ONSITE INTERVIEW
  • Maximum Sum of a Unique-Element SubarrayTekion · ONSITE INTERVIEWTekion interview questions
  • Sliding Window: Target Containment and Most-Repeated WindowRoblox · ONSITE INTERVIEWRoblox interview questions
  • Invalid Transactions in Time OrderBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Sliding Window MedianNotion · ONSITE INTERVIEWNotion interview questions

Capital One interview 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
  • Capital One TDP Agentic Power Day: 25 Experiences (Part 1 of 2)
All Capital One interview questionsSee Capital One hiring insights
Saved
class Solution {
    public int[] findDuplicateTransactions(int[] timestamps, String[] accounts, String[] merchants, int[] amounts) {
        // Write your code here.
    }
}
Checking account…