⌘K
Flycodx

Air Quality Index Pollution Hotspot Mapping

Air Quality Index Pollution Hotspot Mapping

HardArrays100% accepted

Sanjana works for an air quality monitoring NGO in Delhi. Given AQI readings from multiple monitoring stations, she needs to identify pollution hotspots by finding regions where AQI exceeds critical thresholds and calculate the affected population area. Rule: cells > threshold form hotspots; regions connect 4-directionally. Return the size (cell count) of the largest hotspot region, 0 if none. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.

Approach

Given a 2D grid of AQI values and a critical threshold, find all connected regions where AQI exceeds threshold and return their total area.

Input

grid=[[150,200,120],[180,250,140],[160,190,130]] threshold=160

Output

4
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3