Count Unique Meal Combos

Hard ⏱ 18 min 32% acceptance ★★★★☆ 4.2
Orders arrive as lists of item names, where ["burger", "coke"] and ["coke", "burger"] are the same combo. Write count_unique_combos(orders) that counts distinct combos. A plain set cannot be stored inside another set — pick the right hashable type.

Examples

Example 1
Input
count_unique_combos([['burger', 'coke'], ['coke', 'burger'], ['pizza']])
Output
2
Explanation

The first two orders are the same combo regardless of order.

Constraints

  • Item order within an order must not matter.
  • Duplicate items in one order count once.

Topics

Setsfrozenset

Companies

SwiggyZomatoUber

Hints

Hint 1

frozenset is hashable and order-free.

Hint 2

Build a set of frozensets and return its length.

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