No Double-Booked Employees

Easy ⏱ 8 min 72% acceptance ★★★★☆ 4.4
Two shift rosters must never share a person. Write no_overlap(shift_a, shift_b) that returns True when the two lists of employee IDs have no common member.

Examples

Example 1
Input
no_overlap([1, 2, 3], [4, 5])
Output
True
Explanation

No ID appears in both shifts.

Constraints

  • Return a boolean.
  • Empty rosters never overlap.

Topics

Setsisdisjoint

Companies

WalmartAccenture

Hints

Hint 1

Sets have a method that answers this directly.

Hint 2

set(a).isdisjoint(b).

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.