Go Back

DSA

Owl.CO
Senior Software Engineer
Problem Description

You are given a list of customer orders.
Each order is represented as a string, where each character represents an item bought by a customer.

A bundle is a combination of exactly size items from one order.

Write a function that returns all bundles of length size that appear in at least 2 different orders.

Each bundle should be sorted alphabetically, and the final result should also be sorted alphabetically.

Example

orders = ["ABCD", "ACD", "BCE", "ACD", "XYZ"]
size = 3

print(find_popular_bundles(orders, size))

Output:

['CKW', 'EKW', 'QYZ']

Description 1
Hints

No hints available for this question.