Lamport timestamp assignment
Your task
Assign Lamport logical timestamps to a sequence of events across processes. Each event is [proc, type, arg]. For type 'local', the process increments its clock by 1. For type 'send', the process increments its clock by 1 and the message is tagged with that clock; arg is a message id. For type 'recv', the process sets its clock to max(local_clock, received_timestamp) + 1; arg is the message id being received (its send must appear earlier in the list). Every process starts at clock 0. Return the list of assigned Lamport timestamps, one per event in input order.
Examples
lamport_timestamps(events: list[list]) -> list[int]Example 1
Input
lamport_timestamps([["P1", "local", None], ["P1", "send", "m1"], ["P2", "recv", "m1"]])Output
[1, 2, 3]