DMSi has a secure access room with a card reader on each side. You must scan to enter and scan to exit. However, we've been having some issues with access logs lately. It seems that while the card reader is permitting entry, it is dropping some logs. We need to determine if it is the fault of the reader or the fault of the individuals' proxy cards. In order to do so, we must identify which employees have a dropped log entry.
Our logs are formatted as a List of tuples, where the first item is the employee name, and the second item is the type of read, enter or exit.
[
('Paul','enter'),
('Mary','enter'),
('Mary','exit'),
('Paul','exit'),
];
We want to get a tuple where the first item is a List of employee names whose exits failed to log, and the second item is a List of employee names whose entries failed to log.
(
[
/* exits */
],
[
/* entries */
],
);
An example would be the case of Paul this morning. He scanned into the room, presumably spent some time in there, and then left. However, his exit did not log.
[
('Paul', 'enter'),
('Mary', 'enter'),
('Benedict', 'enter'),
('Mary', 'exit'),
('Benedict', 'exit'),
];
Given this log, we would want to return a tuple that looks like this:
(['Paul'], []);
Importantly, the room is physically empty at the start and end of the day. So we can be certain that if a person's first entry is an exit
or last entry is an enter
that they are missing a log.
Since we are really just trying to debug a hardware problem, we don't need a verbose list of every bad record. Rather, we want a list of bad exits and entries where an employee appears only once in each list. If Paul has multiple bad entries, he should only appear once in the badEntries
Array. However, if he had a bad entry and bad exit, he should appear only once in both Arrays.