Confluent·Software Engineer·Technical Phone Screen
- Design a SensorHealth class that takes a log of IoT sensor pings (sensor ID and timestamp), and for a given query (sensorId, T), determines whether a sensor is STABLE or UNSTABLE. The check uses a 300-second window from T divided into five 60-second slots; a sensor is UNSTABLE if any 3 or more consecutive slots have no pings. Optimize for repeated queries.
“The slot bucketing part came to me pretty fast, just dividing the window into five ranges and checking each one.”