PracHub
QuestionsPremiumLearningGuidesCheatsheetNEW
|Home/Coding & Algorithms/Bloomberg

Find invalid transactions in time-sorted input

Last updated: Mar 29, 2026

Quick Overview

This question evaluates string parsing, temporal reasoning, and algorithmic efficiency by requiring identification of transactions that exceed a numeric threshold or violate cross-city time-window constraints in already time-sorted input; it tests knowledge in Coding & Algorithms with emphasis on algorithm design and data-structure use for time-window processing. It is commonly asked because it measures the ability to process ordered or streaming data while meeting a linear-time complexity target, reflecting practical implementation and algorithmic problem-solving skills rather than purely theoretical concepts.

  • medium
  • Bloomberg
  • Coding & Algorithms
  • Software Engineer

Find invalid transactions in time-sorted input

Company: Bloomberg

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem You are given a list of transaction records, already sorted in **non-decreasing order by time**. Each transaction is a string in the form: `"name,time,amount,city"` - `name`: lowercase string identifier - `time`: integer minutes - `amount`: integer - `city`: lowercase string A transaction is **invalid** if **either** of the following holds: 1. `amount > 1000`, or 2. There exists **another** transaction with the **same** `name` that occurred within **60 minutes** (inclusive) of this transaction, but in a **different** `city`. Return **all invalid transactions** (as the original strings). Order does not matter. ## Requirements - Input is globally time-sorted. - Target time complexity: **O(n)** (or close to it, amortized). ## Example Input: - `["alice,20,800,mtv","alice,50,100,beijing","bob,50,1200,mtv"]` Output could include: - `"alice,20,800,mtv"` (diff city within 60) - `"alice,50,100,beijing"` (diff city within 60) - `"bob,50,1200,mtv"` (amount > 1000)

Quick Answer: This question evaluates string parsing, temporal reasoning, and algorithmic efficiency by requiring identification of transactions that exceed a numeric threshold or violate cross-city time-window constraints in already time-sorted input; it tests knowledge in Coding & Algorithms with emphasis on algorithm design and data-structure use for time-window processing. It is commonly asked because it measures the ability to process ordered or streaming data while meeting a linear-time complexity target, reflecting practical implementation and algorithmic problem-solving skills rather than purely theoretical concepts.

Related Interview Questions

  • Solve meeting and tree problems - Bloomberg (easy)
  • Minimize travel cost with two cities - Bloomberg (easy)
  • Check connectivity between two subway stations - Bloomberg (easy)
  • Design a data structure for dynamic top‑K frequency - Bloomberg (hard)
  • Find tree root and bucket numbers - Bloomberg (hard)
Bloomberg logo
Bloomberg
Dec 15, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
9
0

Problem

You are given a list of transaction records, already sorted in non-decreasing order by time.

Each transaction is a string in the form:

"name,time,amount,city"

  • name : lowercase string identifier
  • time : integer minutes
  • amount : integer
  • city : lowercase string

A transaction is invalid if either of the following holds:

  1. amount > 1000 , or
  2. There exists another transaction with the same name that occurred within 60 minutes (inclusive) of this transaction, but in a different city .

Return all invalid transactions (as the original strings). Order does not matter.

Requirements

  • Input is globally time-sorted.
  • Target time complexity: O(n) (or close to it, amortized).

Example

Input:

  • ["alice,20,800,mtv","alice,50,100,beijing","bob,50,1200,mtv"]

Output could include:

  • "alice,20,800,mtv" (diff city within 60)
  • "alice,50,100,beijing" (diff city within 60)
  • "bob,50,1200,mtv" (amount > 1000)

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Bloomberg•More Software Engineer•Bloomberg Software Engineer•Bloomberg Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.