values and an integer step. Choose some elements, keeping their original order, so that each chosen element is exactly step more than the previous chosen one (with a negative step, that means smaller).
Return the largest number of elements such a chain can have. A single element counts as a chain.values=[4, 1, 7, 2, 10, 13], step=3 → 4
The chain 4, 7, 10, 13: each value is exactly 3 more than the previous one.
values=[9, 6, 5, 3, 0], step=-3 → 4
The step is negative: 9, 6, 3, 0.
values=[2, 2, 2], step=1 → 1
No pair differs by 1, so the chain is a single number.
values=[4, 1, 7, 2, 10, 13], step=3
4
Run checks the first 3 tests in your browser. Submit checks all 156 tests on the server, hidden ones included.