Next Greatest Element

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 49

  • @tarek7451
    @tarek7451 2 роки тому +1

    Brilliant solution and clear explanation. Thanks!

  • @naboulsikhalid7763
    @naboulsikhalid7763 11 місяців тому

    well explained, with simple algorithm. thank you a lot

  • @BruceLee-gh7oi
    @BruceLee-gh7oi 4 роки тому

    This is one of best coding channel

  • @nagesh007
    @nagesh007 10 місяців тому

    Awesome Sir 😍

  • @codestorywithMIK
    @codestorywithMIK 7 років тому +1

    Very well explained. Thank you

  • @lakshsrivastava5751
    @lakshsrivastava5751 4 роки тому +7

    This is a wrong solution in case of 1 2 3 4 5 Correct o/p will be 2 3 4 5 5 but according to his solution it will be 5 5 5 5 5 .
    we need to use stack to reduce the time complexity to O(n).

    • @asim-gandu-phenchod
      @asim-gandu-phenchod 4 роки тому +1

      It is better to see the video again. You have totally misunderstood the algorithm

    • @asim-gandu-phenchod
      @asim-gandu-phenchod 4 роки тому

      In the case of 1 2 3 4 5 correct output would still be 5 5 5 5 5. Because you have to choose the largest number in the array. Please see the video again as the guy has explained with perfection

    • @bharathwaj2890
      @bharathwaj2890 4 роки тому

      Yes this is wrong we have to use stack for it

  • @akashakya
    @akashakya 6 років тому +1

    if change swap the 7 and 15 like that 3,4,20,6,7,2,1,15 then it will give wrong NGE for 6 as 15 which is actually has to be 7.

    • @Kestrel1971
      @Kestrel1971 5 років тому

      [20,20,20,15,15,15,15,15] is the correct answer.

  • @ashiqurrahman6635
    @ashiqurrahman6635 7 років тому +1

    Please make a video about time complexity.

  • @rewanth19
    @rewanth19 7 років тому +1

    excellent stuff, please continue to upload content. :)

  • @sethgoodwin292
    @sethgoodwin292 7 років тому

    I have a Binary Search Tree with the addition that each node is colored Red or Black (it is not a Red Black Tree). I'm writing methods to determine if the given BST is a valid Red Black Tree (all Red Black Tree properties are met). The only method I cannot figure out is the property that any path from any node to any null node contains the same number of black nodes. Any suggestions?

  • @chethankumar2958
    @chethankumar2958 6 років тому +3

    You're damn good teacher!!

  • @sergeistelmakh
    @sergeistelmakh 3 роки тому

    best, thank you bro

  • @aditya13707
    @aditya13707 7 років тому +1

    sir can you make a vedio on matrix in place rotation

  • @JohnWick-zc5li
    @JohnWick-zc5li 7 років тому

    Thanks Sir ...what happend to duplicates -- 7 . 7 . 15

  • @arjikarthik1880
    @arjikarthik1880 7 років тому

    please put a video on snake and ladder problem

  • @ashishsinha8893
    @ashishsinha8893 7 років тому

    Sir if u don't mind u can make videos of programming of scheduling algorithm...

  • @varunsaproo4120
    @varunsaproo4120 7 років тому

    If possible please upload parallel binary search

  • @savitharachuri
    @savitharachuri 5 років тому

    Hi Sir,
    I want to learn data structures and algorithm in Python language. What measures can be taken? And where do I start? I would like to discuss this with you personally if you don't mind.

  • @stoicio
    @stoicio 6 років тому +2

    I don't think this is a correct solution. For the case [ 6, 7, 3, 8] the output will be [8, 8, 8, 8] while the correct output will be [7, 8, 8 , 8].
    Please correct me if I am wrong.

    • @Kestrel1971
      @Kestrel1971 5 років тому

      [8,8,8,8] is the correct answer.

    • @mohamedmagdy9480
      @mohamedmagdy9480 5 років тому

      The correct answer is [8, 8, 8, 8] because 8 is the maximum element in the array and it is the rightmost one.

    • @lakshsrivastava5751
      @lakshsrivastava5751 4 роки тому

      yes the solution is wrong

    • @dossymzhankudaibergenov8193
      @dossymzhankudaibergenov8193 3 роки тому

      @@lakshsrivastava5751 this question not about next greater element, its about next greatest element

    • @raushankumar8897
      @raushankumar8897 2 роки тому

      @@lakshsrivastava5751 it is asking for next greatest element not next greater element. Next greater element is tough though

  • @nitheeshashik
    @nitheeshashik 7 років тому

    Please add Travelling sales man problem

  • @codewithree930
    @codewithree930 3 роки тому

    thanks a lot!

  • @imrwe9691
    @imrwe9691 7 років тому

    Could you please make a video on wine problem for dynamic programming not able to understand .As there are no resources.Pls sir

  • @Ankit13555
    @Ankit13555 7 років тому

    SIR NEW VIDEOS????

  • @ayushsrivastava5659
    @ayushsrivastava5659 4 роки тому

    Next greatest element for 3 is 4..isn't it?

  • @palak443
    @palak443 4 роки тому

    3 should be replaced by 4

    • @asim-gandu-phenchod
      @asim-gandu-phenchod 4 роки тому

      You have totally misunderstood the algorithm. Watch the video again to understand the working of the algorithm

  • @firstname-ox2lw
    @firstname-ox2lw 7 років тому

    please make a video reagrding N Queen Problem of backtracking. I cannot understand properly. Please help me in this one sir. Thanking you

  • @Mithunkumar-yy5hj
    @Mithunkumar-yy5hj 2 роки тому

    Sir pls write complete program

  • @ADITYAPANDEY-jm8yk
    @ADITYAPANDEY-jm8yk 4 роки тому +1

    totally wrong code..it wont run for example like 1 2 3 4,. here correct output will be 2 3 4 -1 but your code will give 4 4 4 -1

    • @asim-gandu-phenchod
      @asim-gandu-phenchod 4 роки тому

      The correct output is 4 4 4 4. The comparison is made with the whole array from that particular element till the end of array. Anything greater in that portion is selected. See the video again so that you can understand better.

  • @madhukarsain1895
    @madhukarsain1895 4 роки тому

    very nice explanation but this logic is not proper.

  • @kaushikkumar4548
    @kaushikkumar4548 7 років тому

    i am a great fan of yours, just a small piece of advice, please cross check the solutions you provide, this solution is wrong, and a couple more of your solutions are wrong from other videos

    • @LarryRuane
      @LarryRuane 7 років тому

      Can you please explain why it is wrong? I don't see any mistakes.

    • @nickjames2059
      @nickjames2059 6 років тому

      it is wrong...

    • @Kestrel1971
      @Kestrel1971 5 років тому

      @@nickjames2059 No, his algorithm is correct. The title of the video may be causing some confusion. The goal is to replace the integer at the current index with the highest integer in the subset of the array from the current index to the end of the array.