Maximum Information (DA)
Problem Overview
- Pick a starting server to maximize the sum of security values gathered by jumping x -> x+K until leaving the network; values may be negative.
- Input: n, K, and security_val[1..n]; Output: the maximum total security value.
- Constraints: 1≤n≤1e6, -1e3≤security_val[i]≤1e3, 1≤K≤n.
- Real-world: models a hacker traversing a computer network; a Jpmorgan interview question, common coding interview problem.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
