The Jump Game problem involves determining if you can reach any index with value zero in an array of non-negative integers, starting from a given index. From any index i, you can jump to i + array[i] or i - array[i], but you cannot jump outside the array boundaries. This problem can be solved using Breadth-First Search (BFS) or Depth-First Search (DFS) to explore all possible paths from the starting position. The key challenge is understanding the problem statement correctly and implementing the search algorithm while handling boundary conditions and visited indices to avoid infinite loops.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Dumbest guy doing leetcode live day 43Added:
Given an array of nonative array, we are initially positioned at start index of array.
When you are at index i, you can jump to i + a r of i or i minus a r of i. Check if you can reach any index with Z 1 5 4 All possible ways to reach at index three with value zero are you mean I have to reach from here to here using this index five to four. You have to minus one second.
[ __ ] I can't even understand.
Given an array of non integer a r, you are initially positioned at start index of array. When you're at index i, you can jump to the i plus a r of i or i of i. Check if you can reach any index.
Check if you can reach any index with us.
Check.
What does that mean?
There are no ways to reach index one with value zero.
One possible way to reach at index three with value zero. 0 1 0 1 2 3 is index 4 again.
Uh uh.
Is this a DFS search? What the [ __ ] I thought it was an array problem.
[ __ ] I can't even process the question right now.
Even an array of non integer neon non- negative integer r initially positioned at five I mean start start of index array.
When my start is five, then it should be 0 1 2 3 4 5. So then then my start would be like one.
What are they saying? Do I need to resill the first index or we have to add up all these values and check if we can reach to the first index.
I need to find the possible path that will lead me to the first value of the element array.
So why is this question so hard, man?
Given an ar of non- negative integer a r you're initially positioned at start index of array when you're at the index i you can jump to i + 1 or I minus array of I check if you can reach any index with value zero check any index how can I reach from that index I mean do I need to check if I can go here or here value zero all possible ways reach index three with value 0 or maybe it can be like 6 - 5 6 - 1 4 - 2 I mean 4 + 1 what is this bro this a hard question.
Literally, I can't even understand the question right now. What the hell?
How is this even working?
So you are given an array of non negative integer and you initially positioned at start of the index at the start index of the array. So this is my start index.
So which means this is one sorry this is zero this is 1 2 3 4 uh I mean this is the fifth index I guess 0 1 2 3 4 this should be fifth index I guess won't be considered as index 1 2 3 4 okay let's consider three itself Since there they have told the question since they told like all all possible ways to reach at index three which is like this. So this is uh let's consider this as a fifth index. Uh since array is zero index and okay so if we start at the fifth index now what do I need to do now?
When you're at I index I, you can jump either to ar I + array of I + Y. Why I plus?
Imagine if I at uh three, right?
So if we are at three 0 1 2 3 where is if we are we are at here like imagine if we are at three then they're saying uh you have to add i + ar of i. Oh which is uh so this is zero right? 0 1 2 3 4. So if I add if I add this thing then what will my answer will be?
It will be six I guess third index plus the next index which is our start index.
This one our element is at five right.
So if I add current I value which is three and my element value which is three it will give me six.
And what are we supposed to do with the six? Now check if you can reach any index with value zero.
Check if you can reach any index with value zero. This is not understandable.
Check if you can't reach any index with value zero.
Are you saying I have to subtract this?
I mean if if I'm at fifth index and if we add this together we get six.
We get six right six. And if I subract this back then it is two again.
Again if you sub this one it will minus one.
So we have to reach but in index with value zero. This is what the [ __ ] is this?
Check if you can reach any index with value zero. So if you can reach any index with value zero when you at index I when you're at index I I'm my current index is this one uh three right now here and you can jump to the I + I + I six or uh this is fourth integer then this will be of six array of uh uh I minus I - I right I - I so this will be like 0 and this shouldn't this give meus same this is the beginner But what the hell can you can check if you can reach any index with value zero?
Notice that you can't jump outside the array any time. All possible ways to reach index three with value zero or index five. Index 4 index four.
index one index three index one index five index six index five six index 4 index one index three which is this one this one uh >> they have given me an area and they have given me starting position in the index of I when you're at index I you can jump to I + 1 or I - 1 I minus of I check if you can reach any index check if you can reach any index can I reach any index from here yes I can reach Here I reach it here. Even I can reach here.
What the hell is the question? Why am I getting the falls here?
Input a r of 3 0 2 1 1 start equals to output false. There is no way to reach index one with value zero.
There is no way to reach index one value.
We have to calculate the values and check if we can reach till first index.
I can't understand the question. This is my 0 1 2 and my two is currently on this this one here.
And if I move here which is 1us.
So we have to go on the front side. That's it.
Oh the I going to ask the AI to explain me the question. I'm not able to understand it.
You are standing at index zero of array.
At every position I value array of I tells you how far you can jump.
[ __ ] I knew that. That's what I was asking.
From index I, you can jump forward position or backward position. Check if you can reach any index with value zero.
You're not allowed to go.
Son of a [ __ ] bro. You're saying the same question again. Like, what the hell is this?
He literally explained me the same thing again.
At every every position I the value of array of I tells you how far you can jump.
Every position I the value of ar.
So if I'm at start see 0 1 2 3 4 and this is my fifth element right 1 2 3 4 5 so this is my fifth element and what are they saying? Do I need to reach till the first index?
Check if you can reach any index whose value is zero.
Oh. Oh [ __ ] We have to reach zero.
Uh if we're able to reach zero, I mean yeah we can reach here.
012 012.
Can't I reach here? Why I can't reach here?
There is no way to reach index one with value zero. Why? Why I can't reach?
Since my two is bigger than zero and I have to calculate the index, right?
I need to subtract the index. So, which will be like my first index minus this value.
Then I should be able to reach here. Why is this pause?
Hello. What's up?
Bro, I'm stuck with the question, man.
Like I can't even understand the question. Now what I understood is that I need to uh check if from my start index which is the start value uh this is 0 1 2 3 4 which is three here and I have to check if array of i + 1 uh can I not ar + 1 I mean uh yeah ar + 1 yeah ar of i + 1 or area of i - Does that lead me to the uh index where value is zero?
If it is there then it is true.
Let me see where we are getting false here.
Okay. Yeah. Minus minus one can't be the index of an array since it is outside of array. Oh [ __ ] Oh [ __ ] Okay.
either a r of i + 1 or a r of uh i - 1. This is what they gave right.
Sorry, not ius one. Sorry, not ius.
Oh, even even the order matters are what?
I don't know if the order matters. Even if I do this, it should be the same, right? Either it can be array of I plus this thing or like I this thing.
Problem of the day I plus a R of I.
So now we have to calculate and see if my if my index is going out of the bound or not.
If it is going out of the bound and you are not able to reach zero then we have to return uh false otherwise I have to return true there is a question I guess I don't know if this is the question then we have we can just proceed with that I will be my start and I will go to go to length Let current equals to 100.
I + of I.
Let's run. Let's get back index.
Yes.
If my front index equal to zero I need to return front end equal to true. uh we are calculating if my a I plus a r of i this is a this plus this even this should be giving me false value I guess since 3 minus 3 - uh what is the index of x 0 1 What the [ __ ] 0 1 2 0 1 2 3 3 - 3 zero.
Yeah. Okay. Okay.
Will this work or not? Bro, they have to keep on result flag.
They have to return again.
Okay, I'm getting undefined. So, I have to return it outside.
Let me keep on Uhoh.
use regression. No idea man.
So we did not even reach zero. How is this possible?
whenever my front index is equal to zero then only I'm making the flag true then why the heck do I need to declare it false by default I'm getting very huge number.
I have to do a ar Uh flag is not working.
I'm really sorry.
H my friend value is like I plus a of I and back back index is like I minus A of I and if my front index or back index equals to zero then I'm making a factory else if I'm checking if my See I'm checking if my back index and front index is not less than zero.
If it is less than zero then I have to right What is wrong here?
If I define my flag inside then I'm not not able to use the value outside and I think position from start I'm starting with the starting and you can either jump this from this and check if you can reach any index if I= even this should work right like print index is like I plus a r of i which should be never equal to How will my I + I be equal to Z?
I think subtraction might work but I don't think adding them will get me error of zero sorry here I mean I mean zero imagine if we are at uh fifth index right fifth index and this is my fifth index from here if I subtract this 0 1 3 and five.
This is not equal to zero.
So meloic is wrong.
They have told to do with the BFS and BFS.
What am I supposed to do with the B?
I need to check if um start complicated.
If I have to do the recussion then how start from index and check what do I do + one in data But why is this not working bro? This is is this wrong solution or like I'm doing it in a wrong way or did I understand the question itself wrong?
So you're saying that this will not work at all.
Let me explain. Let me explain. Just let me know if uh uh if I had understand the question right they have given me a non- negative integer a ar r r and initially we will start with the start pointer which is five I mean here as per the case it's five and any index of array I mean yeah they given five now and when when you are at the index I so imagine if you're at index zero Now we are at index this thing right you have to come from the first index itself. I do I have to start from the start index only right.
You can either you can either jump on i + a r of i or ius of i and this will be not equals to z.
I think I have to compare something else.
See my front index won't give me uh zero. I guess even my back index is not giving me zero.
After checking my current index which is current index current index values is equal to.
So will that be like this? All right.
Okay. See If a i + a r of i is greater than zero then I have to decrease I we have to write I minus of I inside this.
If my I + I greater than So paper.
If uh while my start is less than end then until that this will run. Now we have to check if my uh H start index.
So if I check my start less than equals to you need to check if my a r of start index equal equals to zero.
If I use y loop then how will I add an i there?
I can't add an i. Right? I need an i.
pointer.
Which index? Yeah, I think you know I is basically start where you are standing.
Oh, so we need to check if my start index plus a R of start index equals to Z.
is entered.
Otherwise, we have to start = to start minus 100.
Start index start and end.
Start index= to Z.
See, you have to check the lesser and greater Increment, decrement, start until you reach the value.
So here error of I is less than zero then.
here. Uh Bro, I think I'm doing wrong.
How they do with the father?
My start is less than that won't work I guess.
Let me try.
It's Now if I do error of error of I then it will be every time true since the zero exist in the array.
You just go and check if my zero existing in the existing Why are they telling me if BFS Think of think of BFS to solve the problem.
This is problem.
Sorry.
BFS BFS BFS question how they update regression they g so they have given me a start which is root something like root Start.
Start.
Now we have to do BFS, right? How do I do BFS?
First we need to check the condition, right?
If my start now we have to apply okay we can we can make this itself as an recursive function right how do I come Error of start= 0 otherwise I trade over the right and left side I guess.
So if right and left side so we have to iterate on the right side and check if value is not there then we have to add one one other iterate on the left side one get the current value as zero then return true otherwise return Can you mutate the array itself?
If we if we mark them as negative then this one consider right and this will be ignored now we have to only do recursive part now question how can I can reach will be there since I'm not creating any the main. So what are the element we going to pass a r start it can be plus start Or can we here go to the right started?
Best of all, why my call exceeded?
Why my call stock got exceeded, bro?
What the [ __ ] Is because of this thing.
I'm assuming since I'm checking for the condition on the top side.
I'm sorry.
Okay.
in college.
Why people are using Q? Okay, they are using iterative method. I did the requesting method.
Thanks for this guy. Someone told me to do the same. So I got some idea since after making them as uh negative then I ignored them by sticking this thing and on the left and right side actually it method right.
First we have to store the first starting value starting the starting index that is zero Q length and if my A current of current less than the same as mine. But but why did you use Q then? Like you did the same thing here.
But again you would have done with the by marking them as negative and jumping on this many.
I did compare them equality.
I was trying to do this some other [ __ ] I was trying to do.
Are you from college long time?
I push the pre Hey there.
Something.
Some from root till question again.
Don't The sun.
tree to leave.
Someone is going to I try and That's not really not there. Exit and we added a sum.
We have to sum up all this thing also.
Let me run this.
55. Crazy.
There you are.
If no return zero Oops.
Big number.
27.
2757.
If my sun is less than the sun is less than all the sun 22 I don't have to go till end of the row children's We get the value stick.
without exist.
negative value.
Ready?
There are some Nothing.
Left or right?
Sum plus= along with the purple.
Sum will be zero.
Sum is getting added.
Sorry.
Getting added to some if it's not and if some We see some flag.
Let us uh check once previous root current sum root is empty false.
What if I return it will show me undefined?
If no root then return sum plus equals to this thing.
If you reach till end of the lead node and check if there is nothing left after that then give some and return to this and pass Nice.
Oops.
What's wrong?
I think it's going to pop.
Why nothing is printed?
Console.
Why is it not even getting Let me check what I did.
We are returning the flag and we have initialized the flag with checking if the root is not there directly from and my current sum is root.
I'm checking if my root left is existing or root right is existing. Not any we and path is found some target some is found and found where it is sum. So we return true to I mean we store true and we return from right here.
Curly braces, bro. What the hell?
Just because it won't but single it can be written without brace right still getting wrong.
That's not because of cy braces.
Did I return something wrong? Right.
I have to return here.
Ah [ __ ] If I remove this braces then it will not work. is why it's why why it can't work.
Technically, it should work. It's because of return thing. So, return is not able to find that.
It's working, bro. What the [ __ ] bro?
Then my return was in wrong position.
Uh I have to return here once we find the flag then we have to return.
How other people have solved this?
I use EFS.
Same solution. Same solution.
Same solution.
What the [ __ ] is this?
Literally did manually everything.
Did you manually calcate everything since the constraint was smaller even though like it's more than more than solutions?
I can't even see the code.
Okay, we have a scroll.
So what he's doing is like he took the current and root in current. Is he using some prefix some can't use prefix some right?
What is this doing?
But I'm not in college.
Why do you people think like uh if someone is doing le code then they must be in the college?
I'm not a college student.
I don't work also.
I'm currently unemployed.
I am hunting for HR right now.
What the [ __ ] you do with those those things, man? Like, come on, man. Ask something that is relevant to this thing.
So, what the [ __ ] No idea, man. No idea. I'm not pro. I'm not pro.
I'm just learning DSA right now.
You're asking the wrong person right now. What the [ __ ] [ __ ] dumb, bro.
Literally asking the wrong person, bro, bro. It can even It can be even nested, bro. What the [ __ ] left right.
Yeah.
Yeah. Uh 1 1804 by is near.
At least Right. Sorry. Left, left, left, right.
Okay. You don't want to don't want to try join if you want you can discord we have like 56 people there I don't remember 53 65.
If you want, you can join.
What the [ __ ] Oh, by This is my left alone. Left and right 91.
Watch 48.
Is it related to the ML and question.
Easy question.
So some manage damn.
Let's Oh [ __ ] I don't Damn boy.
Crazy, bro.
be left right there.
But whenever I come to left, I can right and left.
Oh, nice.
2025 24 I think. 26 December.
pattern. Learning John here.
Minimum 20 30 downs.
Bench.
It's a pattern.
Which state are you from?
Uh born in Bihar but currently living in Chennai.
This link is fast and slow.
already practically.
Solve 15 to 20.
Yes, a decent fundamentals.
Interesting.
Almost 120.
I think 140 14 market.
Happy evening.
Thank you.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01











