Company: Turing_7may
Difficulty: medium
Problem 1 Problem Description In an enchanted dungeon, there are n wizards aligned in a row. Each wizard possesses a unique attribute that can either provide or drain your energy. Some wizards might even reduce your energy, meaning they drain energy from you. You've been cursed with a spell that forces you to teleport after gaining energy from wizard i to wizard (i + k). This teleportation continues until you reach a point where (i + k) is beyond the last wizard in the sequence. In simpler terms, you select a starting wizard, then repeatedly teleport k positions forward, gathering energy from each wizard you land on, until you can no longer teleport. Given an array energy and an integer k, determine the maximum amount of energy you can collect. Examples Example 1: Input: energy = [7,-3,8,-2,4], k = 2 Output: 19 Explanation: Starting from wizard 1, you can collect a total energy of 7 + 8 + 4 = 19. Example 2: Input: energy = [3,4,5,-7], k = 3 Output: 5 Constraints 1 -1000 1