Company: D. E. Shaw

Difficulty: medium

Problem Statement

Find Tasks with Fluctuating Resource Limits You are given `n` resource-limit logs. Each log contains four integers: `task_id`, `start_time`, `end_time`, and `limit_value`. For each task, order its logs by increasing `start_time`. Ignore consecutive equal limit values. A task has **fluctuated** if its remaining sequence contains at least one strict increase and at least one strict decrease. Return all fluctuating task IDs in increasing order. Input Format The first line contains an integer `n`. Each of the next `n` lines contains `task_id start_time end_time limit_value`. Output Format Print the qualifying task IDs in increasing order separated by spaces. Print an empty line if none qualify. Constraints `1 <= n <= 100000`; `1 <= task_id, limit_value <= 10^9`; `1 <= start_time < end_time <= 10^9`. Logs of one task do not overlap. Example Input: ``` 5 1 1 2 4 1 3 4 7 1 5 6 3 2 1 2 5 2 3 4 5 ``` Output: ``` 1 ``` Task 1 rises from 4 to 7 and then falls to 3. Task 2 nev

More D. E. Shaw OA questionsInterview experiences