Algorithm · C3.ai · Medium
You are given an array of integers and an integer k. Produce every combination that consists of exactly k of the array's elements, where the chosen elements in each combination must appear in the same relative order they have in the original array. Follow-ups Design an API that, on each call, returns the next combination, with the combinations handed out in lexical order across successive calls. Examples Example