Best Time To Buy & Sell Stock 1 (LeetCode 121) | Full solution with visuals and animation

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

КОМЕНТАРІ • 95

  • @movocode
    @movocode 10 місяців тому +9

    How come your views are so low....its literally the best explanation i am getting on youtube ....already watched few of your videos...always thinking why you are so underrated.

  • @kyayaaromkar
    @kyayaaromkar Рік тому +43

    Why are his lectures not having enough views? They are so good.

    • @GeetainSaar
      @GeetainSaar 7 місяців тому +3

      Thumbnail

    • @Arun30802
      @Arun30802 6 місяців тому +3

      They love only clickbait and trends. He is treasure, hope he start DSA course, I will buy at any cost.

    • @patelg6759
      @patelg6759 6 місяців тому

      ​@@GeetainSaar obviously this is the main reason but once you watch you'll search NIKIL lohia

  • @sreeharsharaveendra289
    @sreeharsharaveendra289 Рік тому +11

    Your clear explanation is so good. Clearly this video deserves more views, bless you!

    • @nikoo28
      @nikoo28  Рік тому +1

      thanks for your appreciation and motivation :)

  • @iamrahulraj1919
    @iamrahulraj1919 Місяць тому +1

    This is the kind of teaching that truly makes a difference. The way you broke down the problem step by step and logically arrived at the solution is commendable. You didn’t just solve the problem; you taught us how to think critically and approach challenges methodically. Thank you for such insightful teaching!

  • @yashrajput8566
    @yashrajput8566 8 місяців тому +10

    one of the best yet simple solution i have seen so far.

  • @zmonkey111
    @zmonkey111 2 роки тому +8

    So happen I randomly found you. Thank you for the content. You are definitely helping me understand the coding mindset.

  • @MythBuster28_10
    @MythBuster28_10 10 місяців тому +1

    This explanation deserves more views and sharing with friends and colleagues. Simply brilliant

  • @vipulaggarwal8518
    @vipulaggarwal8518 5 місяців тому +1

    we are learning 2 things from you in every video
    1. obviously problem solving
    2. how to communicate efficiently. the way you express your thoughts is phenomenal
    your english is so simple and easy to understand
    I also wants to become as good as you in communication skills.

  • @AlenCarner
    @AlenCarner 12 днів тому

    This shows how really actually conscious working hard people are very few , and it proves by the video views

  • @atmurisaimouli4697
    @atmurisaimouli4697 Рік тому +2

    Mind Blowing Explaination , Very Clear and Consice

  • @TheDQR
    @TheDQR 3 місяці тому

    Great explanation, hands down one of the best videos explaining problems from leetcode, I will suscribe and keep watching more. I actually was able to resolve the problem with your explanation and not by looking at your code, and I tried to watch the solution of this problem in other videos. Thanks for the video man.

  • @sourabhtiwari5137
    @sourabhtiwari5137 Рік тому +2

    better than more phd holder, great explanation

  • @zeus4963
    @zeus4963 3 місяці тому

    Litreally the best tutor i have ever got! Thank you so damn much bro!

  • @manansarraf73
    @manansarraf73 7 місяців тому

    bhaiya whenever i got stuck in DSA you always saved me. i have watched number of videos of yours on DSA and always got the best solution always

    • @nikoo28
      @nikoo28  7 місяців тому

      It's my pleasure

  • @akankshajain3997
    @akankshajain3997 Рік тому +1

    such a clean explanation with visuals, thank you!

    • @nikoo28
      @nikoo28  Рік тому

      so happy you like them

  • @harshitagoswami989
    @harshitagoswami989 Рік тому +3

    You are a gem!

  • @nrted3877
    @nrted3877 Місяць тому

    Thanks I am learning from you, your explanation is very comfortable to me.

  • @subhashpathak8978
    @subhashpathak8978 Місяць тому

    Thanks for explaining this approach in simple words

    • @nikoo28
      @nikoo28  Місяць тому

      I'm happy it was easy to understand.

  • @anuradhae9146
    @anuradhae9146 Рік тому +1

    really appreciate your effort to explain and how to reach to solution step by steps. It is great help. keep it up!! thanks lot

    • @nikoo28
      @nikoo28  Рік тому

      you are very welcome!!

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

    Really Good content... Best video lecture on UA-cam. Keep doing good work

  • @enriquegrageda
    @enriquegrageda 11 місяців тому +1

    You should be a tutor or teacher,
    thanks for uploading :D

  • @devotie_
    @devotie_ 4 місяці тому

    😍superb explaination, tq bro 😊 tq so much😊😊😊

  • @shivesh.mishra
    @shivesh.mishra 5 місяців тому

    As usual I respect my teachers most but.
    Uh got the respect from it's peak.📈❤

  • @imrn4u
    @imrn4u 5 місяців тому

    great explanation with clear and concise way.

  • @bhawnachauhan4375
    @bhawnachauhan4375 Рік тому +1

    You explained so well😊

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

    Brother your explanation is love

  • @rohitrajsingh4638
    @rohitrajsingh4638 Рік тому

    best explanation that i found

  • @riyarai9226
    @riyarai9226 7 місяців тому

    Thank you so much sir, this explanation was super helpful.

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

    very underrated channel

  • @chandanaarvapally
    @chandanaarvapally 6 місяців тому

    You are toooo good! Thanks a lot sir

  • @hoang640
    @hoang640 Рік тому

    Very clear explaination
    Thank you so much

  • @lymmontijo87
    @lymmontijo87 Рік тому

    Thank you so much, this explanation was super helpful.

  • @devotie_
    @devotie_ 4 місяці тому

    Excellent explaination🥰❤😊 bro

  • @xzcgvxzcvxzcvxcv
    @xzcgvxzcvxzcvxcv 11 місяців тому +1

    It's more better explanation than neetcode) thx

  • @MoralStories292
    @MoralStories292 8 місяців тому

    the best explanation❤❤❤❤

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

    Thanks man. Good coding.

  • @anubratsahoo447
    @anubratsahoo447 5 місяців тому

    Underated teacher

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

    Great explanation ❤

  • @ashok2089
    @ashok2089 6 місяців тому

    Best explanation..thanks!

  • @vpvpsilly2927
    @vpvpsilly2927 Рік тому +1

    great explanation....thank you sir

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

    Thank you for your great explanation..it will be great if you solve hackerank array manipulation problem

  • @susanjoshi5948
    @susanjoshi5948 5 місяців тому

    You are awesome!

  • @MuhammadAbdullahZahid-b7f
    @MuhammadAbdullahZahid-b7f 7 місяців тому +1

    great understanding

  • @isabelgraciano9282
    @isabelgraciano9282 Рік тому

    great video and very well explained 😃

  • @sudhadevi6692
    @sudhadevi6692 Рік тому

    Bhaiya tussi GREAT ho!!!🎉

    • @nikoo28
      @nikoo28  Рік тому

      you are great too :D

  • @VikashSingh-sf2xp
    @VikashSingh-sf2xp 5 місяців тому

    very nice explanation.

  • @pavankumarpadamati8606
    @pavankumarpadamati8606 Рік тому

    nice explanation ...keep it bro🤩

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

      Thank you, I will

  • @ankitajha3962
    @ankitajha3962 5 місяців тому +1

    Was able to code on my own

  • @aniketrawat3224
    @aniketrawat3224 Рік тому

    Thanks, it was really helpfull...

  • @mohammadfahad6076
    @mohammadfahad6076 Рік тому

    great explanation👍

  • @techtoss7515
    @techtoss7515 4 місяці тому

    excellent!!

  • @-IT-ARGHYASINGHA
    @-IT-ARGHYASINGHA 10 місяців тому

    thank you very much sir nicely explained

  • @quantisticnumbers2633
    @quantisticnumbers2633 Рік тому

    Thanks for the video

  • @aryanbhagat9852
    @aryanbhagat9852 2 місяці тому +1

    The code given in the video is failed on the Testcase : [1,2]
    So I modified the profit updation part a little please do check once.
    class Solution {
    public int maxProfit(int[] prices) {
    int buy_price = prices[0];
    int profit = 0 ;
    for(int i=1 ; i < prices.length ; i++){
    if(prices[i] < buy_price){
    buy_price = prices[i];
    }
    else if (prices[i] - buy_price > profit){
    profit = prices[i] - buy_price ;
    }
    }
    return profit ;
    }
    }

  • @mithic
    @mithic 5 місяців тому

    brother i think even if we remove the else block and write update the currentProfit directly it should still work

  • @manishasharma434
    @manishasharma434 Рік тому +1

    Pls do cover all the parts of buy and sell problem if possible

    • @nikoo28
      @nikoo28  Рік тому

      yep...I do have that on my mind 😄

  • @hariboy123
    @hariboy123 Рік тому

    i love your english

  • @everyontech2716
    @everyontech2716 Рік тому

    well explained

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

    Thankyou sir.

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

    I wrote the code myself and I am confused with the test cases...[3,2,6,5,0,3] expects the output to be 4 whereas [2,1,2,1,0,1,2] expects output to be 2. So in first testcase, the 0 price is not valid whereas in the 2nd, 0 buy price is valid ??

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

      try debugging and you will be able to follow along the step you are missing

  • @TrungNguyen-eo7qz
    @TrungNguyen-eo7qz 10 місяців тому

    How to find and return the indices of best day to buy and best day to sell with max profit?

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

      that is another problem...and will cover it at a later point in time

  • @subee128
    @subee128 Рік тому

    Thanks

  • @kidoo1567
    @kidoo1567 Рік тому

    U are looking like that guy who host the show "the mad" in pogo❤

    • @nikoo28
      @nikoo28  Рік тому

      haha...you mean rob?

  • @asifkhanak7792
    @asifkhanak7792 Рік тому

    what is the name of this algorithm?

    • @nikoo28
      @nikoo28  Рік тому

      Kadane's algorithm

  • @adityathakur9714
    @adityathakur9714 Рік тому

    Sir please write code also at the last by yourself

    • @nikoo28
      @nikoo28  Рік тому

      I want to focus on the problem solving part rather than the code part. Once the algorithm is clear to you...writing the code in any language isn't hard at all. Every good company you interview for...they will only be interested to judge if you are able to think logically.
      Plus, I also provide a production level code at the end with a dry run, full code and test cases on Github as well.
      So my question to you is, did you face any problems while understanding how to solve?

    • @adityathakur9714
      @adityathakur9714 Рік тому

      @@nikoo28 No bhaiyaa the thing is I just started coding I understand the logic very well with your explanation but I'm not able to write in a limited time and bhaiya you explain so well that I understand the logic easily.

    • @nikoo28
      @nikoo28  Рік тому

      If you have just started your coding journey…all the more reason to try and write the code yourself…follow the logic and debug along the way.
      Pause and take your time. No rush to just complete the number of problems.

    • @adityathakur9714
      @adityathakur9714 Рік тому

      @@nikoo28 okk bhaiya i will give my best

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

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

    👍

  • @Venkateshprabhu5
    @Venkateshprabhu5 3 місяці тому +1

    It's more difficult to understand why your videos are getting low views than to understand the problem 😂

  • @riyarai9226
    @riyarai9226 7 місяців тому

    Thank you so much sir, this explanation was super helpful.

  • @InfernoisLive-i7
    @InfernoisLive-i7 3 місяці тому

    Thanks

  • @moneylogyy
    @moneylogyy 18 днів тому

    thanks