All problems

Unclaimed Raffle Tickets

Easy · hash set

A school fair sold raffle tickets, each with a number printed on it. You are given two lists of integers.

Return the numbers of the tickets that were sold but never scanned.

Each number must appear once in the answer, even if it appears several times in sold. List them from the smallest number to the largest. If every sold ticket was scanned, return an empty list.

Examples

Example 1

Input: sold = [14, 3, 9, 3, 21], scanned = [9, 40, 14]

Output: [3, 21]

Tickets 14 and 9 were scanned. 3 and 21 were not. 3 was sold twice but is listed once. 40 was never sold, so it is ignored.

Example 2

Input: sold = [5, 6, 7], scanned = [7, 6, 5, 5]

Output: []

Every sold ticket was scanned.

Example 3

Input: sold = [8, 2], scanned = []

Output: [2, 8]

Constraints