Company: DevRev

Difficulty: medium

Problem Statement

Maximize K for Skill Points Problem Description You are getting ready for an athletic competition and have `n` training drills available. Doing the `i`-th drill raises your skill level by `arr[i]` points. You may perform only one drill per day, and after doing a drill you must let `k` days pass before repeating that same drill. For instance, if `k=2` and you perform drill 1 on day 1, you cannot repeat drill 1 on days 2 or 3, but you can repeat it starting from day 4. You are given two targets: reach at least `c` skill points within `d` days. Find the largest `k` for which this target is still achievable. If no such `k` exists, or `k` can be arbitrarily large, output `-1`. Examples Example 1: Input: n = 2, c = 5, d = 4 arr = [1, 2] Output: 2 Explanation: One way to earn 5 skill points across 4 days with K=2 is: Day 1: do exercise 2, and gain 2 skill points. Day 2: do exercise 1, and gain 1 skill points. Day 3: do nothing. Day 4: do exercise 2, and gain 2 skill points. In total, 2+1+2=5

More DevRev OA questionsInterview experiences