ความคิดเห็น •

  • @atish4185
    @atish4185 3 ปีที่แล้ว +50

    One of the most underrated channels in coding. You're fabulous Sir! :)

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +7

      Thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

    • @firozalam2749
      @firozalam2749 ปีที่แล้ว

      @@Pepcoding what is the meaning of pepcoding /

  • @adilkhatri7475
    @adilkhatri7475 2 ปีที่แล้ว +16

    that J < I condition is very important to keep the time complexity O(n) otherwise in case of ascending order array the time complexity will be O(n*k).

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      For more detailed and curated content on DSA, Web Dev etc visit nados.pepcoding.com :)

  • @anmolgirdhar4473
    @anmolgirdhar4473 3 ปีที่แล้ว +8

    The best solution for interviews, I did meditation for the 3 points, and now I am feeling confident for the WHY of the solution.

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +7

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @ankoor
    @ankoor 3 ปีที่แล้ว +27

    One of the best solutions. So intuitive!

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +5

      Glad to know that you liked the content and thank you for appreciating.
      Keep motivating, keep learning and keep loving Pepcoding😊
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @viditvaish7317
    @viditvaish7317 8 หลายเดือนก่อน +1

    amazing ,aapse accha dsa youtube pr koi bhi nahi explain kr pata ,agar aapki videos na mile to ques fas jata hai ya samajhne me bahut time lagta hai baki jaigah se ,aapse ek baar me clear ho jata hai.Thanq

  • @rohandsouza9147
    @rohandsouza9147 3 ปีที่แล้ว +3

    The graph representation really helped me to understand the concept, I'll remember this for my life !! Definitely recommending this channel to my friends

  • @AyushKumar-fk5lm
    @AyushKumar-fk5lm 3 ปีที่แล้ว +5

    Sumeet Sir Amazing!!!!!! Aapke alawa is question ko itne achhe se koi nahi samjha sakta! It took a lot lot effort. Pranaam aapko _/\_

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +3

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @nomadshubham3907
    @nomadshubham3907 3 ปีที่แล้ว +1

    And finally I follow only pepcoding for all coding related stuff...
    Isse badiya kuch nahi 🔥😀

  • @pulkitnijhawan653
    @pulkitnijhawan653 3 ปีที่แล้ว +3

    There are a lot of solutions on the net using a deque but this is his is highly intuitive ...Thanks for posting these solutions...but doing j=i everytime instead of only when j

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +4

      Thankyou beta!
      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem. If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

    • @arpitpachauri9189
      @arpitpachauri9189 2 ปีที่แล้ว

      yes i was also getting TLE when solving on leetcode.

  • @PraveenKumar-ch5is
    @PraveenKumar-ch5is 3 ปีที่แล้ว +19

    If the numbers are in increasing order, you are essentially check each element in the window . Then time complexity will be same as brute force

  • @anishsuman1371
    @anishsuman1371 3 ปีที่แล้ว +5

    If array is sorted in ascending order time complexity will be 0(n*k) so worst case complexity will be n*k correct me if I am wrong

    • @gaunikasrivastava7851
      @gaunikasrivastava7851 3 ปีที่แล้ว +2

      Yeah, you are right

    • @shushantgaur9420
      @shushantgaur9420 3 ปีที่แล้ว +5

      @@gaunikasrivastava7851 @Anish suman
      actually it will still be O(n). i belive your concern is related to the upgradation of j = next_grater_of_j[ j ]; since we are not starting j from I, it will only take O(1) time every time. if we start j from I each time then of course time complexity will be O(n*k). for elements 1 2 3 4 5 6 7 8 9. if window size is 4. then first time while loop will run 3 times and next greater element will be 4. next time same while loop will start from 4 and will run only once i.e. till 5. and then only once till 6 and so on. so we get O(N) solution . however if we start j =i each time then time complexity increases to O(N*K).

    • @anishsuman1371
      @anishsuman1371 2 ปีที่แล้ว

      @@shushantgaur9420 Yes man you are right

    • @shivamnegi7552
      @shivamnegi7552 ปีที่แล้ว

      @@anishsuman1371 kiss then

  • @harshitasingh963
    @harshitasingh963 3 ปีที่แล้ว

    Youe explanantion is undoubtedly the best !

  • @devanshmesson2777
    @devanshmesson2777 2 ปีที่แล้ว +5

    The time complexity would still be O(N*K).
    Take the case when array is sorted in increasing order.

  • @JaiSagar7
    @JaiSagar7 3 ปีที่แล้ว +9

    sir this question consume my whole day 😭

  • @tanyakemkar310
    @tanyakemkar310 3 ปีที่แล้ว

    Best Solution with best explanation

  • @tanishmahajan2060
    @tanishmahajan2060 9 หลายเดือนก่อน

    very intuitive best solution much better than deque one highly appreciated

  • @mishra1576
    @mishra1576 3 ปีที่แล้ว +1

    Far better then those boring " PHD'S " Professors explanation....

  • @ojasvityagi9569
    @ojasvityagi9569 4 ปีที่แล้ว +3

    Thankyou sir! Amazing video.
    sir, please post one for max frequency stack too. Thankyou!

  • @ritikakumar818
    @ritikakumar818 2 ปีที่แล้ว +1

    one of the amazing explanation of this question.

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Thanks Ritika :) If you want more content like this please visit nados.pepcoding.com

  • @VishalKumar-sm8bo
    @VishalKumar-sm8bo 3 ปีที่แล้ว +6

    best solution ever. Thank you sir!!!!
    TC for this code is O(n)??

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +1

      Thankyou beta,
      I am glad you liked it. I also hope that you are watching till end.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

    • @adityagupta1805
      @adityagupta1805 3 ปีที่แล้ว

      yes bro

    • @shoaibansari6702
      @shoaibansari6702 3 ปีที่แล้ว

      I don't think so because within first for loop he is using while loop to increment j

    • @narayanbansal4036
      @narayanbansal4036 3 ปีที่แล้ว +1

      If i == j is taken everytime in the loop then the TC = n*k in the worst case when the array is sorted
      If the other one is taken then it is linear

    • @KrishnaGupta-xd6xu
      @KrishnaGupta-xd6xu 3 ปีที่แล้ว +2

      @@narayanbansal4036 bhai dhyan s dekh optimization if(j

  • @411_danishranjan9
    @411_danishranjan9 3 ปีที่แล้ว +1

    whats the time complexity of this approach?
    on leetcode , this approach is showing TLE

  • @vrajeshbadgujar
    @vrajeshbadgujar ปีที่แล้ว

    God level explaination!

  • @tusaarkhana3773
    @tusaarkhana3773 3 ปีที่แล้ว

    Thank u sp much sir for ur efforts and motivational reels.

  • @kavyansh8213
    @kavyansh8213 ปีที่แล้ว

    sir 1 small doubt here say i have an array 1 8 12 16 and then the next greater array would be 8 12 16 4 but when you wrote the statement nge[j]

    • @kavyansh8213
      @kavyansh8213 ปีที่แล้ว +1

      ok got it actually it is the index of elements that is being stored in next greater element array thanks sumit sir!

    • @nivealokhande2153
      @nivealokhande2153 ปีที่แล้ว +1

      @@kavyansh8213 i had same doubt, but u cleared it, thnxx

  • @anantjain1263
    @anantjain1263 4 ปีที่แล้ว +2

    Sir aapne nge[j] < i+k kra h iski jgh
    nge[j]< nge[i+k] ni aana chaiye kyuki agar hmara j =1 h or nge[j] = 9 hua to
    9 < 1+4 is not true?

    • @amanaswal11
      @amanaswal11 3 ปีที่แล้ว +5

      Brother! we are storing index in nge array.

  • @rishabhgoyal8110
    @rishabhgoyal8110 2 ปีที่แล้ว

    So intuitive! Hats-off & God-bless you!

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Many many thanks. For better experience visit on nados.pepcoding.com, Also follow our Instagram account to stay tuned.

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Many many thanks. For better experience please explore nados.pepcoding.com
      Also don't forget to follow our Instagram account.

  • @dpxy1599
    @dpxy1599 ปีที่แล้ว

    thanz sir samajh me aa gaya

  • @sakshigupta7616
    @sakshigupta7616 3 ปีที่แล้ว +1

    Great explanation sir!!!

  • @adityagupta1805
    @adityagupta1805 3 ปีที่แล้ว

    Epic level teaching

  • @44_shubhamsharma75
    @44_shubhamsharma75 4 ปีที่แล้ว +1

    Accha explain Karte ho Sir!!

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว

      thank you

  • @bhaskarmishra8479
    @bhaskarmishra8479 2 ปีที่แล้ว

    Great content!

  • @KB-zg8ho
    @KB-zg8ho 4 ปีที่แล้ว +2

    Sir this can be done using deque too in O(n)

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +4

      Agreed. Also, that is easier. If you watch closely this is doing the same thing as Dequeue.

  • @ishanpatni2684
    @ishanpatni2684 4 ปีที่แล้ว +1

    Sir pleaseeeeee upload the level up course further please

  • @akshatsharma6631
    @akshatsharma6631 ปีที่แล้ว

    Thank you sir

  • @jatinlodhi980
    @jatinlodhi980 2 ปีที่แล้ว

    at line no. 21 , it should be st.push(arr[ arr.length-1]);

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      For better insight, visit nados.io, post your doubts, community will help you out there.

    • @kashba
      @kashba 2 ปีที่แล้ว

      no, index comparision kar rahe hai isme

  • @shivammehta9661
    @shivammehta9661 3 ปีที่แล้ว

    Very Nice Explanation Sir......Keep making videos

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      th-cam.com/users/Pepcodingabout?view_as=subscriber

  • @xtenza9065
    @xtenza9065 3 ปีที่แล้ว

    Sir, how do we meditate over a question? If you can give a way for that then that would be great.

  • @deepmala3970
    @deepmala3970 2 ปีที่แล้ว

    this vid is from which
    playlist?

  • @pranadeep_music4389
    @pranadeep_music4389 2 ปีที่แล้ว

    behtareen

  • @biswarupdas9079
    @biswarupdas9079 3 ปีที่แล้ว

    "If the numbers are in increasing order, you are essentially check each element in the window . Then time complexity will be same as brute force"...
    What to do in this case ,sir??
    please reply!!

    • @samiulkhan3744
      @samiulkhan3744 2 ปีที่แล้ว

      nope.... it will still be O(n)...

  • @adityachoudhary1739
    @adityachoudhary1739 4 ปีที่แล้ว

    sir where is the link of that prerequisite video ?

  • @alpishjain1317
    @alpishjain1317 3 ปีที่แล้ว +1

    Awesome video!

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +1

      Thankyou beta!
      Keep learning and keep loving Pepcoding😊

  • @AshutoshSingh-se8vf
    @AshutoshSingh-se8vf 4 ปีที่แล้ว

    Sir,what if j becomes greater than i,
    as you only write smaller than condition ..i.e-if(j

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +1

      agar j == i ho gya to nge dobara calculate karenge.

    • @siddhantprakash.
      @siddhantprakash. 3 ปีที่แล้ว

      I've the doubt..
      did you resolved the problem?

  • @gagantilak3118
    @gagantilak3118 4 ปีที่แล้ว +1

    Sir, can we solve this question using reverse or maximum priority queue?

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +1

      yes, complexity will be higher

  • @NiteshKumar-do4en
    @NiteshKumar-do4en 4 ปีที่แล้ว

    Sir you are great

  • @girikgarg8
    @girikgarg8 ปีที่แล้ว

    Done!

  • @anujrawat6304
    @anujrawat6304 3 ปีที่แล้ว

    if the array is in increasing order then j will jump to each window element which lead to n^2 time

    • @itzmanny8905
      @itzmanny8905 2 ปีที่แล้ว

      Stocks ke value ka graph dekha hai kya kabhi

  • @Sachin95999
    @Sachin95999 2 ปีที่แล้ว

    really good sir

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Keep watching. sign up on nados.io for better experience and well organised content.

  • @anuragkumargupta7506
    @anuragkumargupta7506 3 ปีที่แล้ว

    Hi sir , it is helpful if you provide the vedio link of the questions which is prerequsite for the current questions. or refference vedios

    • @vinamrasangal8436
      @vinamrasangal8436 ปีที่แล้ว

      Sometimes I feel very amazed, how a channel with such a awesome content have only reached 53k subs in last 3years,
      the team and specially Sumeet Sir deserves a minimum of 100k subs...hope they reach this milestone soon.

  • @urvishbundela7826
    @urvishbundela7826 2 ปีที่แล้ว

    Just Wow❣

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Glad to know that you love our video, for better experience.
      Visit - nados.pepcoding.com and sign up to NADOS.
      Don't forget to follow us on Instagram instagram.com/pepcoding/

  • @AshutoshAnand-o5l
    @AshutoshAnand-o5l 7 หลายเดือนก่อน

    Goddamn this guy!!!!
    best for a reason

  • @fashionvella730
    @fashionvella730 3 ปีที่แล้ว

    PLEASE UPLOAD EASY TO ANALYZE INPUT

  • @bloody9162
    @bloody9162 2 ปีที่แล้ว

    Superb!

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      Thanks a lot!
      For better experience and well-organised content
      visit- nados.pepcoding.com
      Also you can post your query on community tab.
      Don't forget to follow us on Instagram
      instagram.com/pepcoding/

  • @prashantnagrurkar2784
    @prashantnagrurkar2784 3 ปีที่แล้ว

    Sir, jo video dekhne bole hai as a prerequisite, uska link bhi dijiye, 2:45

  • @ashishm8850
    @ashishm8850 3 ปีที่แล้ว

    Thank you!

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว

      Keep learning and keep growing😊

  • @syedhabeebuddin101
    @syedhabeebuddin101 3 ปีที่แล้ว

    Thanks !

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว

      Keep learning, Keep growing and keep loving Pepcoding!😊

  • @mradulagrawal1579
    @mradulagrawal1579 2 ปีที่แล้ว

    Wouldnt it be O(n^2) for cases like 1,2,3..n and k=n/2

    • @Pepcoding
      @Pepcoding 2 ปีที่แล้ว

      For such queries sign up on nados.io
      You can post such queries on community tab, our alumni and mentors will guide you.

  • @AnkitAsatiM10
    @AnkitAsatiM10 3 ปีที่แล้ว

    awesome!

  • @ayushgoel9584
    @ayushgoel9584 4 ปีที่แล้ว +1

    sir, the solution which you have discussed is taking O(nk) time. ex- 1,2,3,4,5,6,7,8,9,10. for this j will jump 3 times for every window. i.e. , when array is sorted , time complexity will be o(nk). right??

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +2

      Nope, it'll jump 3 times for 1st window and only 1 time for all subsequent windows. Print i and j in the inner loop for your example.

    • @ayushgoel9584
      @ayushgoel9584 4 ปีที่แล้ว

      @@Pepcoding Ok sir, now i understood, thanks for the reply

    • @crackthecode1372
      @crackthecode1372 4 ปีที่แล้ว

      @@Pepcoding so what would be the time complexity?

    • @codemaestro9904
      @codemaestro9904 4 ปีที่แล้ว +2

      @@Pepcoding The 'if' condition instead of while to update 'j' prevents O(n*k), right ?

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว

      @@codemaestro9904 no, it is the fact that we jump don't just increase j by 1, instead we take it to nge

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 3 ปีที่แล้ว +1

    Sir j peeche chut gya toh age lake barabar krdere, jb j age nikl jara tb ka?

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.
      Also, we have a premium facility available for the students in which you can get the 12 hours doubt support facility. Jisme aap agr kisi bhi question main kahin bhi faste ho to aap doubt support par reach kar skte ho aur aapko TA assign ho jayega and you can get your doubt resolved from them.

    • @siddhantprakash.
      @siddhantprakash. 3 ปีที่แล้ว

      same doubt i've.
      did you resolved it?

  • @omkush3209
    @omkush3209 2 ปีที่แล้ว +1

    This code is not working on leetcode problem -239

    • @CoderAdi
      @CoderAdi ปีที่แล้ว

      yes do you know the solution its showing tle

  • @karthikrashinkar204
    @karthikrashinkar204 3 ปีที่แล้ว

    You look like rakshit shetty brother 😁
    by the way it was really good explanation 👌🏿

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +2

      🤭 wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.

  • @shivangsharma4873
    @shivangsharma4873 4 ปีที่แล้ว

    Sir what is the time complexity of this solution and how can we optimize it??

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +1

      Already optimized. O(n)

  • @ananyasingh1141
    @ananyasingh1141 3 ปีที่แล้ว

    Sir, ismai agar next greater element window ke bahar hoota h toh uss i ke liye whi greatest element hai...woh j kaise detect kar raha idhar...konse part of code m aa raha woh nhi smj aaya...

    • @revaanmishra
      @revaanmishra 3 ปีที่แล้ว

      thats why we're always doing j = i, because if for a window the NGE is outside then J will be at the correct position.

    • @siddhantprakash.
      @siddhantprakash. 3 ปีที่แล้ว

      @@revaanmishra but we are doing that only when ji ?
      how to bring back that to i?

    • @kashba
      @kashba 2 ปีที่แล้ว

      @@siddhantprakash. har loop chalne ke baad vo sliding window ke andar ya i se peche hoga
      agar peeche hai to humne same to i laane ka code krdiya
      aage hai to koi dikkat ki baat nahi hai cuz check bhi hume aage krna hai as sliding window goes ahead

  • @panavkumar9009
    @panavkumar9009 2 ปีที่แล้ว

    I was able to solve 99% question myself but missed that j < i condition due to which I got TLE on LC. Thanks for this explanation.

    • @HAMBIKASHARMA
      @HAMBIKASHARMA 2 ปีที่แล้ว

      Bro last mei
      J=nge
      kyu Kiya hai?

    • @AYJ959
      @AYJ959 ปีที่แล้ว

      @@HAMBIKASHARMA jump krne lie j ko nay nge pr within window

  • @rishabhgoyal2835
    @rishabhgoyal2835 4 ปีที่แล้ว +1

    amazing : )

  • @truegrabbers
    @truegrabbers 2 ปีที่แล้ว

    woow

  • @RajatSingh-dg8ov
    @RajatSingh-dg8ov 3 ปีที่แล้ว +3

    Sir aap badass ho bhaai!. Kya mast he kar dete ho.Please open a patreon, I will pay. Thanks

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +5

      Haha..bro aage 5 saal baad jab apna band bnayunga aur nya youtube channel open kruga tab open kruga patreon😋

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +3

      Bhai, 5-6 saal mei ek music band bnaunga. Uske channel pe patreon rahega.

    • @RajatSingh-dg8ov
      @RajatSingh-dg8ov 3 ปีที่แล้ว

      @@Pepcoding 🤣🤣🤣🤣 sir aap logic mast clear Karne k Saath comedy b Kar dee hi, nice!

  • @SMARTCLIQ
    @SMARTCLIQ 6 วันที่ผ่านมา

    why these que time complexity is not n square

  • @atulbhaskar5919
    @atulbhaskar5919 3 ปีที่แล้ว

    Sir howz the while is working in last FOR loop without incrementing j ? Line no 47

    • @Pepcoding
      @Pepcoding 3 ปีที่แล้ว +1

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

    • @faizan346
      @faizan346 3 ปีที่แล้ว

      you need to check that again we are evidently jumping on next nge and placing our j on that pos. {j = nge[j]}

    • @itachiuchiha-vs3qb
      @itachiuchiha-vs3qb 3 ปีที่แล้ว

      write down the code in paper and trace every iteration.. you will get it..

  • @santoshjoshi3396
    @santoshjoshi3396 2 ปีที่แล้ว

    what about [1.-1] k=1;?

  • @AdityaTyagi-c1m
    @AdityaTyagi-c1m หลายเดือนก่อน

    Line 36 you pushed i but not arr[I]

  • @madhumitabhunia8937
    @madhumitabhunia8937 3 ปีที่แล้ว

    One solution might be with using double ended queque🤔

  • @samirray7544
    @samirray7544 3 ปีที่แล้ว +1

    Wow................ : ) : )

  • @crackthecode1372
    @crackthecode1372 4 ปีที่แล้ว +1

    It is giving tle on ib😞

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว +1

      ek baar aapka solution post kijie. koshish karte hain. complexity iski O(n) he hai.

    • @rochishajaiswal1643
      @rochishajaiswal1643 4 ปีที่แล้ว

      @@Pepcoding
      Sir this code is giving tle on gfg ide. Please help sir.
      import java.util.*;
      import java.lang.*;
      import java.io.*;
      class GFG {
      public static void main (String[] args) {
      //code
      Scanner sc=new Scanner(System.in);
      int t=sc.nextInt();
      for(int r=0;r

    • @45_ritiksharma32
      @45_ritiksharma32 2 ปีที่แล้ว

      Giving tle on pepcoding portal as well

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 3 ปีที่แล้ว

    J=I shi h

  • @ayushsultania
    @ayushsultania 3 ปีที่แล้ว

    for this solution it wouldnt work if input is
    10
    1 2 3 4 1 2 3 4 5 6
    4
    it gives tle

  • @LegitGamer2345
    @LegitGamer2345 4 ปีที่แล้ว

    awesome !

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว

      Thank you! Cheers!

    • @LegitGamer2345
      @LegitGamer2345 4 ปีที่แล้ว

      @@Pepcoding sir I have one doubt , time complexity of this is always O(N) right ?

    • @Pepcoding
      @Pepcoding 4 ปีที่แล้ว

      Yes

    • @LegitGamer2345
      @LegitGamer2345 4 ปีที่แล้ว

      @@Pepcoding okay sir :D