Company: arista

Difficulty: medium

Problem Statement

Count Active Containers You are given events for containers. Each event contains a container identifier, a unique timestamp, and its limit. For each container, order its events by increasing timestamp. A container is active when its limit increases at least once between consecutive events and decreases at least once between consecutive events. Input Format The first line contains `n`. Each of the next `n` lines contains `containerId timestamp limit`. Output Format Print the number of distinct active containers. Constraints - `1 <= n <= 100000` - timestamps are distinct; `0 <= timestamp, limit <= 10^9` - `containerId` is alphanumeric or underscore, without spaces.

More arista OA questionsInterview experiences