Customers in Exactly One Campaign

Medium ⏱ 12 min 46% acceptance ★★★★★ 4.7
Marketing ran an email campaign and an SMS campaign. Write single_channel(email_ids, sms_ids) that returns how many customer IDs were reached by exactly one of the two channels.

Examples

Example 1
Input
single_channel([1, 2, 3], [3, 4])
Output
3
Explanation

IDs 1, 2 (email only) and 4 (SMS only); 3 got both so it is excluded.

Constraints

  • Duplicates within one list count once.
  • Return an integer.

Topics

Setsset algebra

Companies

MetaFlipkartNetflix

Hints

Hint 1

Symmetric difference gives elements in exactly one set.

Hint 2

len() of that result.

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