2757. Generate Circular Array Values ¶ TypeScript 1 2 3 4 5 6 7 8 9 10 11function* cycleGenerator( arr: number[], startIndex: number ): Generator<number, void, number> { const n = arr.length; let index = startIndex; while (true) { const jump = yield arr[index]; index = (index + (jump % n) + n) % n; } }