Chairs Requirement
Updated
Problem statement
For each simulation, determine the minimum chairs that must be purchased. C is an arrival to the workroom, R leaves for a meeting, U returns from a meeting, and L leaves work. An arrival or return uses an available chair or purchases one; a meeting departure or final departure frees one.
Function
minChairs(simulations: String[]) → int[]Examples
Example 1
simulations = ["CCRUCL","CRUC","CCCC"]return = [3,2,4]Tracking the available pool independently for each simulation gives the three purchase totals.
Constraints
1 <= simulations.length <= 1001 <= simulations[i].length <= 10000- Every simulation is a valid sequence over
C,R,U,L.
More Atlassian Online Assessment questions
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Theme Park Shuttle Wait TimeAirbnb · OAAirbnb interview questions
- Macaron Order with Set DiscountsShopify · OAShopify interview questions
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Book Reading EveningsGoogle · OAGoogle interview questions
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
- Lift Total TravelInfosys · OAInfosys interview questions
- Shell Command Counts with History ReferencesTikTok · OATikTok interview questions
- Count Dropped RequestsJP Morgan Chase · OAJP Morgan Chase interview questions
- Recursively Expanded Shell Command CountsHudson River Trading · OAHudson River Trading interview questions