Parcel stack lifts
A depot keeps parcels in one vertical pile. Parcels arrive in the order given by arrivals and each one goes on top of the pile, so the last to arrive sits highest. Names are unique. Couriers then collect parcels in the order given by pickups. To reach a parcel a porter lifts off every parcel sitting above it, one lift each, sets them aside, takes the wanted parcel out, then puts the lifted parcels back exactly as they were, so the rest of the pile keeps its order. A pickup that names a parcel which is not in the pile, because it never arrived or was already collected, costs no lifts. Return how many lifts each pickup needed, in the order the pickups are given, using -1 for a pickup that found nothing.
parcel_lift_counts(arrivals: list[str], pickups: list[str]) → list[int][["ac71","bd02","ce33"],["ce33","ac71"]]out[0,1][["ac71","bd02","ce33"],["ac71","bd02","ce33"]]out[2,1,0][["ac71"],["zz99","ac71","ac71"]]out[-1,0,-1]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[["ac71","bd02","ce33"],["ce33","ac71"]][0,1]not run yetsample[["ac71","bd02","ce33"],["ac71","bd02","ce33"]][2,1,0]not run yetsample[["ac71"],["zz99","ac71","ac71"]][-1,0,-1]not run yetsample