Company: CodeSignal

Difficulty: medium

Problem Statement

Maximum Exercise Cooldown There are `n` exercises; completing exercise `i` earns `arr[i]` points. You may perform at most one exercise per day. After performing an exercise, wait `k` full days before performing that same exercise again. Given a target `c` and `d` days, print the greatest `k` for which you can earn at least `c` points. Print `-1` if it is impossible even for `k = 0`, or if arbitrarily large `k` works. Input The first line contains `n c d`; the second line contains `n` rewards. Example Input: `2 5 4` and rewards `1 2`. Output: `2`.

More CodeSignal OA questionsInterview experiences