We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d3296e commit 0d05042Copy full SHA for 0d05042
Sources/Algorithms/Permutations.swift
@@ -149,11 +149,8 @@ extension Permutations: Sequence {
149
/// Advances `kRange` by incrementing its `lowerBound` until the range is
150
/// empty, when iteration is finished.
151
func advanceKRange() {
152
- if kRange.lowerBound < kRange.upperBound {
153
- let advancedLowerBound = kRange.lowerBound + 1
154
- kRange = advancedLowerBound ..< kRange.upperBound
155
- indexes = Array(base.indices)
156
- }
+ kRange.removeFirst()
+ indexes = Array(base.indices)
157
}
158
159
let countToChoose = self.kRange.lowerBound
0 commit comments