Skip to content

Missing Test Case - 3147. Taking Maximum Energy From the Mystic Dungeon #32803

@shaikh631

Description

@shaikh631

LeetCode Username

ayan_9819

Problem Number, Title, and Link

https://leetcode.com/problems/taking-maximum-energy-from-the-mystic-dungeon/submissions/1797610041

Bug Category

Problem description

Bug Description

Taking Maximum Energy From the Mystic Dungeon

Language Used for Code

Java

Code used for Submit/Run operation

class Solution {
    public int maximumEnergy(int[] energy, int k) {
        int l = energy.length;
        int[] dp = new int[l];
        int result = Integer.MIN_VALUE;
        for (int i = l - 1; i >= 0; i--) {
            dp[i] = energy[i] + (i + k < l ? dp[i + k] : 0);
             result = Math.max(result, dp[i]);
        }
        return result;
    }
    
}

Expected behavior

3 ms
Beats 60.69%

Screenshots

Image

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions