Company: Groww_13nov
Difficulty: medium
Kingdom Problem Description There are N cities in a kingdom numbered from 1 to N. The leftmost city is 1, and the rightmost city is N. Currently, you are in the 1st city. If you want to leave the kingdom, you must survive until you reach the lost city. An array E denotes the energy, and you have T energy. To survive in the i-th city, you need to spend E[i] energy. You have an opportunity to go directly to any of the next K cities from the current city. Determine the number of ways to leave this kingdom. Note Elements in the energy array are always positive. Integers N, T, and K are positive. Function Description In the provided code snippet, implement the provided countWays(...) method to determine the number of ways to leave this kingdom. You can write your code in the space below the phrase "WRITE YOUR LOGIC HERE". There will be multiple test cases running so the Input and Output should match exactly as provided. The base output variable result is set to a default value of -404 which