MediumPro challengePythonJavaScriptTypeScript

Iterable Range Generator

GeneratorsIteratorsFunctions

Implement solve(start, end, step) using a generator function that
yields numbers from start (inclusive) to end (exclusive) with the
given step.

The solve function must return the values collected into an array. Internally
it must use a function* generator (not a plain loop + push).

Bonus: Make the generator lazily evaluated — it should only compute the
next value when requested by the iterator protocol.

Sample tests

Test #1Forward range step 1
Input: [0,5,1]
Output: [0,1,2,3,4]
Test #2Forward range step 2
Input: [0,10,2]
Output: [0,2,4,6,8]
Test #3Backward range
Input: [5,0,-1]
Output: [5,4,3,2,1]
Test #4start === end → empty
Input: [0,0,1]
Output: []
Test #5Step 3 forward
Input: [1,10,3]
Output: [1,4,7]