Skip to content
Programmingoneonone
Programmingoneonone
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerEarth Jump Out problem solution

YASH PAL, 31 July 202411 February 2026
In this HackerEarth Jump Out problem solution, You have a field of N boosters. The power of ith booster is given as Ai. If you stand on ith booster, you will get the power Ai and you can make a jump of length Ai. That is, if you are standing on 3rd booster and it’s power is 5, then you will land on position 8. Currently, you are standing outside the field to the left of first booster and you want to across this field by reaching to the right of Nth booster. You want to make only one jump to any booster such that you will finally land to right of Nth booster. Print the minimum length of initial jump you should make such that you will finally land outside the field by using exactly one booster.
HackerEarth Jump Out problem solution

HackerEarth Jump Out problem solution.

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fre freopen("in.txt","r",stdin)
#define pii pair<pair<ll,ll>, ll>
#define f first
#define s second
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
int A[100011];
int main() {
freopen("in09.txt","r",stdin);
freopen("out09.txt","w",stdout);
int N;
cin >> N;
for(int i=1;i<=N;i++) {
cin >> A[i];
}
for(int i=1;i<=N;i++) {
if(i+A[i] > N) {
cout << i;
return 0;
}
}
}

Second solution

n = int(raw_input())
arr = map(int, raw_input().split())
print next(i for i in range(n) if arr[i] + i >= n) + 1
coding problems solutions HackerEarth HackerEarth

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes