Trending Stock
Updated
Problem statement
Process commands:
process: record one occurrence ofstocks[i], return null.get: choose the stock with greatest current occurrence count, breaking ties by the most recent remaining occurrence; return it and remove that most recent occurrence.
Every get is valid. Return one string per operation.
Function
runTrendingStock(operations: String[], stocks: String[]) → String[]Examples
Example 1
operations = ["process","process","process","get","get","process","get"]stocks = ["TSLA","AAPL","TSLA","","","NFLX",""]return = ["null","null","null","TSLA","AAPL","null","NFLX"]TSLA first leads 2-1; after one removal the tie favors AAPL's later remaining occurrence, then NFLX is newest.
Constraints
- At most
10^4operations.
More Bloomberg LP Onsite Interview questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- 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
Similar questions at other companies
- 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Top K Upvoted Songs by ArtistAmazon · ONSITE INTERVIEW
- LRU Cache with TTLAutodesk · ONSITE INTERVIEWAutodesk interview questions
- Dynamic Median with Additions and DeletionsByteDance · ONSITE INTERVIEWByteDance interview questions
- Tiered Expiring Item StoreHudson River Trading · PHONE SCREEN · ONSITE INTERVIEWHudson River Trading interview questions
- Thread-Safe LRU Cache with TTLLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
- Top K Frequent Elements After Each Stream UpdateSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Limit Order Book Matching EngineCitadel · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Task Scheduler with DependenciesScale AI · ONSITE INTERVIEWScale AI interview questions
- Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
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
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)