Your question is Button Press Program. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Bosch Rexroth operator panel records button identifiers as operators interact with a machine. Given the recorded button presses and a command sequence, find the starting index of the first contiguous occurrence of that command in the log.
Return -1 if the command sequence does not occur. If it appears multiple times, return the earliest starting index. Button identifiers are case-sensitive integers, and a button may appear more than once in either input.
Implement find_button_press_sequence(presses, command).
presses, a list of integers representing the recorded button presses, and command, a non-empty list of integers representing the target sequence.command begins in presses, or -1 when no match exists.def find_button_press_sequence(presses, command):