All Posts

Leetcode 341: Flatten Nested List Iterator

You are given a nested list of integers nestedList, where each element can either be an integer or a sublist containing integers or other sublists. Implement an iterator to flatten this nested list.

Leetcode 900: RLE Iterator

We are given a run-length encoded array where every even-indexed element specifies how many times the following odd-indexed element (a number) is repeated in the original sequence. Your task is to implement an iterator that can return the next ’n’ elements from the decoded sequence when requested.

Leetcode 1286: Iterator for Combination

Design a CombinationIterator class that generates all combinations of a specified length from a sorted string of distinct lowercase English letters, and allows iterating through them in lexicographical order.