FastPrepInvalid Transactions in Time Order
Problems/Invalid Transactions in Time Order

Invalid Transactions in Time Order

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names a well-known problem but changes the input so transaction times never go down. It requires O(n) time and describes a sliding window with a hash map, plus code. We state the sorted input and the output order (the original order) clearly. Our version is about 97% the same as the reported question.

Each string in transactions has the form name,time,amount,city. The array is already sorted by nondecreasing integer time.

A transaction is invalid when at least one condition holds:

  • amount > 1000.
  • Another transaction has the same name, occurs within 60 minutes inclusive, and has a different city.

Return every invalid original transaction string in input order. A conflicting pair makes both transactions invalid.

Function

invalidTransactionsSorted(transactions: String[]) → String[]

Examples

Example 1

transactions = ["alice,20,800,mtv","alice,50,1200,mtv"]return = ["alice,50,1200,mtv"]

The second amount exceeds 1000. The shared city means the first transaction is not invalidated by the time rule.

Example 2

transactions = ["alice,20,800,mtv","alice,50,100,beijing"]return = ["alice,20,800,mtv","alice,50,100,beijing"]

The two transactions share a name, differ in city, and are 30 minutes apart, so both are invalid.

Example 3

transactions = ["alice,20,800,mtv","alice,90,100,beijing","bob,100,100,mtv"]return = []

Alice's transactions are 70 minutes apart, and Bob has no same-name comparison.

Constraints

  • 1 <= transactions.length <= 100000.
  • Each row has exactly four comma-separated fields.
  • name and city contain 1 through 20 lowercase English letters.
  • 0 <= time <= 10^9, and input times are nondecreasing.
  • 0 <= amount <= 10^9.

More Bloomberg LP Onsite Interview questions

  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Incident MonitorStripe · OAStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Shortest Window with Required CountsOracle · ONSITE INTERVIEWOracle interview questions
  • Count Zero Request ServersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Compact Conversations by Unique ListingsSierra · PHONE SCREENSierra interview questions
  • Find Word-Multiset WindowsAmazon · PHONE SCREEN
  • High-Traffic IPs in a Sliding WindowGoogle · ONSITE INTERVIEWGoogle interview questions
  • Flat Records to a Hierarchical TreeAddepar · PHONE SCREEN
  • Product Total With the Cheapest PromotionInstacart · ONSITE INTERVIEWInstacart interview questions
  • Count Equal Code Pairs Within Distance KInfosys · ONSITE INTERVIEWInfosys interview questions

Interview reports that mention this question

  • Bloomberg New Grad Question Bank: 161 Questions (Part 1 of 2)
  • Bloomberg New Grad OOD Follow-ups: 14 Experiences (Part 3 of 5)
  • Bloomberg New Grad SWE Interviews: 98 Experiences (Part 1 of 5)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public String[] invalidTransactionsSorted(String[] transactions) {
        // Write your code here.
    }

}
Checking account…