1286. Iterator for Combination
https://leetcode.com/problems/iterator-for-combination
Description
Design the CombinationIterator
class:
CombinationIterator(string characters, int combinationLength)
Initializes the object with a stringcharacters
of sorted distinct lowercase English letters and a numbercombinationLength
as arguments.next()
Returns the next combination of lengthcombinationLength
in lexicographical order.hasNext()
Returnstrue
if and only if there exists a next combination.
Example 1:
Constraints:
1 <= combinationLength <= characters.length <= 15
All the characters of
characters
are unique.At most
104
calls will be made tonext
andhasNext
.It's guaranteed that all calls of the function
next
are valid.
ac
Previous1285. Find the Start and End Number of Continuous RangesNext1287. Element Appearing More Than 25% In Sorted Array
Last updated