Count IoT devices matching date and threshold
Company: Kneron
Role: Software Engineer
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Take-home Project
Implement function numDevices(statusQuery, threshold, dateStr) that returns the number of IoT devices from a paginated REST API that were added in the month and year given by dateStr (format MM-YYYY) and have operatingParams.rootThreshold > threshold. Query all pages of: https://jsonmock.hackerrank.com/api/iot_devices/search?status=<statusQuery>&page=<pageNumber> (replace placeholders). The API returns JSON with fields: page, per_page, total, total_pages, data (array of devices). Each device has: id, timestamp (UTC ms when added), status, operatingParams { rotorSpeed, slack, rootThreshold }, asset { id, alias }, optional parent { id, alias }. Count and return the number of matching devices.
Quick Answer: This question evaluates handling of paginated REST APIs, JSON parsing and nested-data filtering, month/year date parsing, and numeric threshold comparisons, reflecting skills in data retrieval and programmatic data manipulation.