Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Ultimate Destination #2

Open
Gautham-22 opened this issue Apr 25, 2024 · 0 comments
Open

The Ultimate Destination #2

Gautham-22 opened this issue Apr 25, 2024 · 0 comments

Comments

@Gautham-22
Copy link
Contributor

The repo is missing an important problem:

You're on a quest to unlock the ultimate travel destination, hidden behind a series of mystical landmarks. To reveal the secret location, you'll need a magical itinerary unlocked by pronouncing the right travel spell. This spell is concealed within a collection of magical travel guides scattered across the world. You start at the first landmark, with each number in the cryptic magical code representing the allure and wonder of each destination. Your goal is to journey through these landmarks, soaking in their magic and accumulating enough travel energy to unveil the ultimate destination hidden at the end.

Return true if you can reach the final landmark while absorbing enough travel energy to discover the ultimate destination, or false otherwise.

Input Format:

Line 1 - an integer that signifies the size of “nums”
Line 2 - a sequence of integers “nums” that signifies the magical code

Constraints:

1 <= nums.length <= 10^4 0 <= nums[i] <= 10^5

Output Format:

return true/false

Sample Input 0

5
2 3 1 1 4

Sample Output 0

true

Explanation 0

Jump 1 step from index 0 to 1, then 3 steps to the last index.

Sample Input 1

5
3 2 1 0 4

Sample Output 1

false

Explanation 1

You will always arrive at index 3 no matter what. Its maximum jump length is 0, which makes it impossible to reach the last index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant