As reported: Atlassian P40 Karat screen (2025), first coding problem: from entry and exit badge records, ordered by time, find the people who forgot to badge in or to badge out. The second coding problem was a follow-up of a similar nature.
A secure room logs badge events. records[i] = [name, action] with action "enter" or "exit", in time order. Everyone starts the day outside the room and should end it outside.
- If someone enters while already inside, or is still inside at the end of the day, they forgot to badge out.
- If someone exits while outside, they forgot to badge in.
Return two lists: the names of people who forgot to badge out, and the names of people who forgot to badge in. Each list holds a name at most once, sorted alphabetically.
Example 1
records = [["Martha","exit"],["Paul","enter"],["Martha","enter"],["Martha","exit"],
["Jennifer","enter"],["Paul","enter"],["Curtis","enter"],["Paul","exit"],
["Martha","enter"],["Martha","exit"],["Jennifer","exit"]]
Output: [["Curtis","Paul"],["Martha"]]
Paul enters twice in a row; Curtis never exits; Martha's first event is an exit.
Example 2
records = [["Paul","enter"],["Paul","exit"]]
Output: [[],[]]
Constraints: 0 ≤ records.length ≤ 4·10^4; names are 1–20 letters and digits.
Code runner format: one JSON value per line: records. Implement findMismatchedEntries(records) returning the two lists; the harness prints them sorted, as [[…],[…]].