Validate scan prefix

Write codeEasy10 min

Your task

A picker scans items one by one, and the scans so far should match the start of the pick list exactly. Given the codes scanned so far and the full pick list, return true if the scan sequence is a prefix of the pick list, same values, same order, starting from the first entry. An empty scan log is always a valid prefix. Example: scans [12, 5] against pick list [12, 5, 9] return true.

Examples

scans_match_start(scans: list[int], picklist: list[int]) -> bool
Example 1
Inputscans_match_start([12, 5], [12, 5, 9])
OutputTrue