apple / apple/swift-algorithms

Unique combinations from a collection

Open
#183 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
6.3k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

I noticed there’s a method for counting the unique permutations of a collection - how come there is no equivalent for combinations? For example the unique combinations of length 2 of “aabc” are “aa”, “ab”, “ac”, “bc”. If others think this would be useful Id be interested in trying to implement it !

An equivalent would be `more_itertools.distinct_combinations(collection, k)` in Python

Contributor guide

Open the contributing guide

Research direction

Locate the existing method for counting unique permutations in the Swift Algorithms repository and inspect its related tests. Compare the requested behavior with Python's distinct_combinations(collection, k), including the “aabc” length-2 example; done means the equivalent combinations operation is implemented and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.