Problem · Array
Maximum Information (DA)
Learn this problemProblem statement
There is a computer network consisting of n servers, or nodes, numbered from 1 to n, and each node has a security value security_val[i]. A hacker must choose a starting node, start jumping through the network compromising servers along the way until reaching the end. From node x, the hacker can jump to node (x + K). If node (x + K) does not exist, the jump is out of the network and the hack ends. Initially, the hacker has access to 0 servers with 0 security value. The security value at each compromised node is added to the hacker's security value sum, and values may be negative.
The task is to choose the starting node optimally such that the hacker compromises servers with the maximum possible security value sum.
Function
maximumInformation(security_val: int[], k: int) → intExamples
Example 1
security_val = [2, -3, 4, 6, 1]k = 2return = 7
The security value sum is
security_val[1] + security_val[3] + security_val[5] = 2 + 4 + 1 = 7.Constraints
1 <= n <= 10^6-10^3 <= security_val[i] <= 10^31 <= k <= n
More JPMorgan Chase problems
- Bitwise XOR SubsequencesOA · Seen Jul 2026
- Array ChallengeOA · Seen Jun 2026
- Minimum Cores to Handle ProcessesOA · Seen Jun 2026
- About ShippingOA · Seen Jun 2026
- Count Dropped RequestsOA · Seen Jan 2026
- Generate Table of ContentsOA · Seen Jan 2026
- Calculate Net ProfitSeen Jun 2025
- Find Total WeightSeen Jun 2025