Badge Entry and Exit Count Violations
Updated
Problem statement
You are given two lists of names from conference-room badge logs: entry contains people who badged in, and exit contains people who badged out. Each list is independently in timestamp order, but the timestamps and the relative order between the lists are not supplied.
For this exercise, assume the observation covers completed visits: the room starts and ends empty. Define a count violation as a person whose number of entry records differs from their number of exit records.
Return each person with a count violation once, in lexicographic order. Repeated occurrences represent separate badge records and must be counted.
This exercise checks count mismatches only. Equal entry and exit counts pass this check; these two lists alone do not establish a merged timeline for detecting badge-order violations.
Function
badgeViolations(entry: String[], exit: String[]) → String[]Examples
Example 1
entry = ["Alice","Bob","Alice"]exit = ["Bob","Cara"]return = ["Alice","Cara"]Alice has two entries and no exits; Cara has no entries and one exit. Bob has one of each.
Example 2
entry = ["Alice","Bob"]exit = ["Bob","Alice"]return = []Both names have one entry and one exit. Relative event timing is unavailable and does not alter the count criterion.
Example 3
entry = ["Lee","Lee"]exit = ["Lee"]return = ["Lee"]Lee has two entries and one exit; the name is returned once.
Constraints
- For this exercise, assume
0 <= entry.length, exit.length <= 500. - For this exercise, assume every name contains
1through50case-sensitive ASCII letters, digits, or underscores. - Empty lists are permitted. Within-list order has no effect on the count criterion.
More Atlassian Phone Screen questions
- Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
- Longest Consistent Activity StreakPHONE SCREEN · Seen Sep 2026
- Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
- Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
- Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026
- Word Path Moving Only Right or DownPHONE SCREEN · Seen Feb 2026
- Ordered Badge Entry and Exit ViolationsPHONE SCREEN · Seen Aug 2025
- Two Sum with an Ordered Index PairPHONE SCREEN · Seen Aug 2025
Similar questions at other companies
- Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
- Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
- Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
- Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
- Most Frequent NameAmazon · PHONE SCREEN
- Words with Repeated AnagramsThe Voleon Group · PHONE SCREEN
- Project JSON Fields into a Target FormatBooking.com · PHONE SCREEN
- Product Keyword SearchTesco · PHONE SCREEN
- Verify Words Sorted by a Custom AlphabetTrueFoundry · PHONE SCREEN
- Character Frequencies Across Nested String ListsSnowflake · PHONE SCREENSnowflake interview questions