Camera Log API Sequence
Updated
Problem statement
A camera service keeps two queues for every camera: a command queue and a log queue. Both are FIFO queues, so items come out in the order they went in. You get a list of API operations. Run them in order and return one response for each operation, in the same order.
The starting command and log rows line up by index with cameraIds. Each operation acts on the camera at the same position in operationCameraIds:
POLL_COMMAND: remove and return that camera's oldest command. If its command queue is empty, return"NONE".GET_LOG: remove and return that camera's oldest log. If its log queue is empty, return"NONE".SEND_LOG: add the value at the same position inoperationPayloadsto the end of that camera's log queue, and return"ACK".
A camera's command queue and log queue never affect each other, and no camera affects another camera. For POLL_COMMAND and GET_LOG, ignore the payload value.
Function
cameraLogApiSequence(cameraIds: String[], initialCommands: String[][], initialLogs: String[][], operationTypes: String[], operationCameraIds: String[], operationPayloads: String[]) → String[]Examples
Example 1
cameraIds = ["cam-a","cam-b"]initialCommands = [["reboot","upgrade"],[]]initialLogs = [["boot-ok"],["motion"]]operationTypes = ["POLL_COMMAND","POLL_COMMAND","GET_LOG","SEND_LOG","GET_LOG","POLL_COMMAND","GET_LOG"]operationCameraIds = ["cam-a","cam-a","cam-b","cam-b","cam-b","cam-a","cam-a"]operationPayloads = ["","","","uploaded","","",""]return = ["reboot","upgrade","motion","ACK","uploaded","NONE","boot-ok"]The first two command polls take cam-a's commands oldest first: reboot, then upgrade. The first log read takes cam-b's starting log, motion. The send adds uploaded to cam-b's logs and returns ACK, and the next read returns uploaded. The third command poll finds cam-a's command queue empty, so it returns NONE. Nothing touched cam-a's log queue, so the last read returns boot-ok.
Example 2
cameraIds = ["x","y"]initialCommands = [[],["y-cmd"]]initialLogs = [[],[]]operationTypes = ["SEND_LOG","GET_LOG","GET_LOG","POLL_COMMAND","POLL_COMMAND"]operationCameraIds = ["x","y","x","x","y"]operationPayloads = ["x-log","","","",""]return = ["ACK","NONE","x-log","NONE","y-cmd"]Sending x-log to x returns ACK and does not change y. Reading y's empty log queue returns NONE, and the next read from x returns x-log. Then polling x returns NONE, and polling y returns y-cmd.
Constraints
cameraIds.length == initialCommands.length == initialLogs.length.operationTypes.length == operationCameraIds.length == operationPayloads.length.- Camera IDs are unique non-empty strings, and every operation camera ID appears in
cameraIds. - Every operation type is
POLL_COMMAND,GET_LOG, orSEND_LOG. - Queued values and
SEND_LOGpayloads are non-empty strings other than the reserved valueNONE.
More Verkada Phone Screen questions
- Host Log ParserPHONE SCREEN · Seen Sep 2026
- Find the Unique User with Access to Every CameraPHONE SCREEN · Seen Sep 2026
- Valid SudokuPHONE SCREEN · Seen Sep 2026
- Common Camera Motion IntervalsPHONE SCREEN · Seen Sep 2026
- Time-Based Key-Value StorePHONE SCREEN · Seen Aug 2026
- Find Valid IP AddressesPHONE SCREEN · Seen Apr 2026
Similar questions at other companies
- Callback Signal RegistryCandid Health · PHONE SCREEN
- Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
- Rate Limiter Sliding Window With Per-Entity LimitsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Recent Event Stream QueriesSnowflake · PHONE SCREENSnowflake interview questions
- Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
- Duplicate News Within 60 SecondsBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Article Vote TrackerRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- FIFO FizzBuzz Market MatchingGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Completions API Rate LimiterCursor · PHONE SCREENCursor interview questions
- Dynamic Least-Loaded Job DispatcherCresta · PHONE SCREENCresta interview questions