thank you so much, I understood the problem but took a while to get why in your code totalDiff
@abhishekverma76048 ай бұрын
class Solution { public: int canCompleteCircuit(vector& gas, vector& cost) { int gs = gas.size(); int cs = cost.size(); int gasSum = 0; int costSum = 0; int start = 0; int currGas = 0; for(int i = 0;i
@honeybansal9165Ай бұрын
bro ek point ko baar baar mt repeat kra kro.. sunne wala pagal hojata h.
@user-hf4ck1lg5sАй бұрын
till intuition part its good but after that not good.
@akanshabhardwaj505525 күн бұрын
nyc explaination
@MaheshGautam-y8i10 ай бұрын
key = agar answer hota to wo pura traverse kar jata
@HelloWorldbyprince9 ай бұрын
yup
@gurjotsingh3726 Жыл бұрын
very underrated brother, great explanation, made it look easy
@sujalchandrakar38743 ай бұрын
doubt :- suppose there are 5 indices and we have succesfully eliminated first 3 indices, it means answer will be now either 4th index or 5th index. Now if start calculating fuel from 4th index and it remains positive after traversing whole array , ans we return 4th index as answer . but there is chance na that when it goes into loop after 5th index (which we didnt check in code) it goes -ve at any index before 4th ... in that case answer will become 5th index na ...but code will return 4th index
@PeterParker-i6g2 ай бұрын
i did it with brute force but always time limit exceeding at 38 th test case. can it be done with brute force or must be done with an optimal
@rishav144 Жыл бұрын
great explanation ...pls continue with leetcode questions
@HelloWorldbyprince Жыл бұрын
Thank you, I will
@smitj54047 ай бұрын
kyaa baat hai sir :) bohot badhiyaa, intuition achhe se samjhaya, thanks a lot !!!
@HelloWorldbyprince7 ай бұрын
Thanks a lot keep sharing my channel
@sksadiruddin41913 ай бұрын
bohut maza aya awasome solutionnnn
@sakshamshrivastava348211 ай бұрын
can we solve it using queue or stack? and if not .. why?
@VedanshandStavyaSaxena7 ай бұрын
great vid
@HelloWorldbyprince7 ай бұрын
Thanks a lot keep sharing my channel
@jeetdesaimusic7 ай бұрын
Thank you very much bhai,great explanation🙏🙏
@HelloWorldbyprince7 ай бұрын
Always welcome
@pranavpranjal27174 ай бұрын
nice explanation brother
@pragynasmitasahoo74434 ай бұрын
great explanation!
@akshanshsharma60258 ай бұрын
you are gem bro i solved it by myself just watch first 6 minutes and its done
@HelloWorldbyprince8 ай бұрын
Thanks Please share this channel with your friends
@Curiousss_Shivammm4 ай бұрын
I knew the condition that we can skip those whose cost is less than gas but still there can be a scenario where 2 starting point both give positive difference in starting but in one it travels completely while in other in some station it couldn't go further and hence not the answer . For this conditon shouldn't your code break you are only judging by starting gas difference
@omrasal50143 ай бұрын
i have one question , the array is not circular ....then how its working
@Curiousss_Shivammm3 ай бұрын
@@omrasal5014 I used module n for it
@tahmiszubair16444 ай бұрын
nice explanation
@guru80355 ай бұрын
Great explanation
@shivangisrivastava11587 ай бұрын
Amazing , very useful thought process!
@HelloWorldbyprince7 ай бұрын
Glad you think so!
@SushantKumarGond2 ай бұрын
Thank you
@harshitaajaria83 ай бұрын
awesome bhaiya💗👌
@soumyamondal Жыл бұрын
Prince Bhaiya make videos on Greedy Algorithm.
@HelloWorldbyprince Жыл бұрын
Sure 👍
@csithub Жыл бұрын
Very nice explanations big bro
@HelloWorldbyprince Жыл бұрын
Thanks yaar ❤️ please share and support my channel