Company-style OA practice sets with full problem statements, sample test cases, and solutions.
Have you recently taken Cisco's Online Assessment or coding test? Share the questions, test cases, or assessment patterns you encountered. Earn SWE180 Coins for every verified submission and use them to unlock other company OA sets and premium tools for free!
A national rail operator runs a single high-speed line with M consecutive segments (1-indexed). Throughout the day, N reservation events arrive in chronological order.
There are two types of events:
1. `BOOK l r p`: A passenger has booked a journey across segments [l, r] contributing cost p. After this event, every segment in [l, r] increases its cumulative cost by p.
2. `QUERY l r`: Asks for the minimum cumulative cost among segments in [l, r] reflecting all preceding BOOK events.
The auditor wants to replay the day's log and emit one answer for every QUERY event.
Every run must ALSO produce one final value: the threshold-event index t (1 <= t <= N). That is, the 1-based event index after which some segment's cumulative cost first reaches or exceeds the threshold T (i.e. >= T). If no segment ever reaches T, output -1 as the final value.
Process the entire log efficiently for up to 2 * 10^5 events and 2 * 10^5 segments.
Example 1
Input
6 5 15 BOOK 1 3 5 QUERY 1 6 BOOK 4 6 10 QUERY 2 5 BOOK 3 4 6
Output
0 5 5
Explanation
M = 6 segments, N = 5 events, T = 15.
- Event 1 (BOOK 1 3 5): Segments 1..3 increase by 5 -> [5, 5, 5, 0, 0, 0]. Max cost is 5 < 15.
- Event 2 (QUERY 1 6): Minimum cost in segments [1, 6] is 0 -> output 0.
- Event 3 (BOOK 4 6 10): Segments 4..6 increase by 10 -> [5, 5, 5, 10, 10, 10]. Max cost is 10 < 15.
- Event 4 (QUERY 2 5): Minimum cost in segments [2, 5] is min(5, 5, 10, 10) = 5 -> output 5.
- Event 5 (BOOK 3 4 6): Segment 3 increases to 11, segment 4 increases from 10 to 16. Since 16 >= 15, segment 4 reaches threshold T at event 5!
Final threshold-event index is 5.
A ride-share company is replaying a stream of pricing logs to detect anomalies in fares. Each ride log contains a request with timestamp t (in seconds since a fixed reference epoch) and a fare f.
The fairness team wants to know: for every ride in the log, was its fare strictly above the 90th percentile of fares in the past 5 minutes (300 seconds)?
Concretely, ride i is flagged as surge-anomalous if its fare f_i is strictly greater than the 90th percentile of fares in its window (t_i - 300, t_i].
The 90th percentile is computed using the nearest-rank convention: in a window of size n, the 90th percentile fare is the fare at the ceil(0.9 * n)-th position (1-indexed) after sorting all fares in the window in ascending order. The current ride itself counts toward the window (so n >= 1).
Notice that whenever a window has fewer than 10 rides (n < 10), ceil(0.9 * n) = n, which corresponds to the window's maximum fare. Since no element can be strictly greater than the maximum, a window of size < 10 can never flag (output is 0).
Output, for each ride in chronological order, 1 if it is surge-anomalous, 0 otherwise.
Example 1
Input
6 0 1000 60 1200 120 5000 240 1100 360 6000 420 1300
Output
0 0 0 0 0 0
Explanation
At each ride, the 300-second window contains fewer than 10 rides (window size <= 6). By the nearest-rank convention, the 90th percentile is the maximum fare in the window. No ride can strictly exceed the maximum, so all outputs are 0.
Gain complete transparency into the Cisco online assessment process. Prepare effectively with real, verified coding challenges, test patterns, and platform details.
Wondering what top companies are actually asking in their initial screening rounds? We provide exact Data Structures, Algorithms, and logical reasoning questions reported by candidates who recently took the Cisco online tests. Stop guessing and start practicing the right problems.
Understand exactly how many questions to expect, the typical time limits, and the platforms used (e.g., HackerRank, Codility, CodeSignal). Knowing the format in advance is the first step to clearing the Cisco OA.