Skip to content

Practice Human Traffic of Stadium

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#601
LeetCode Problem

Human Traffic of Stadium

Problem Statement

Tables: Stadium(id INT, visit_date DATE, people INT). Stadium.visit_date is unique; dates increase as ids increase. Return id, visit_date and people for every row belonging to a run of at least three consecutive ids where every row has people >= 100. Consecutiveness concerns ids, not adjacent calendar dates. Order by visit_date ascending.

Source: Human Traffic of Stadium on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Stadium table: +------+------------+-----------+ | id   | visit_date | people    | +------+------------+-----------+ | 1    | 2017-01-01 | 10        | | 2    | 2017-01-02 | 109       | | 3    | 2017-01-03 | 150       | | 4    | 2017-01-04 | 99        | | 5    | 2017-01-05 | 145       | | 6    | 2017-01-06 | 1455      | | 7    | 2017-01-07 | 199       | | 8    | 2017-01-09 | 188       | +------+------------+-----------+
Output
+------+------------+-----------+ | id   | visit_date | people    | +------+------------+-----------+ | 5    | 2017-01-05 | 145       | | 6    | 2017-01-06 | 1455      | | 7    | 2017-01-07 | 199       | | 8    | 2017-01-09 | 188       | +------+------------+-----------+

Related LeetCode Problems

Practice more problems similar to Human Traffic of Stadium.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.