Best Time to BUY and SELL STOCK | Leetcode | C++ | Java | Brute-Optimal

Поділитися
Вставка

КОМЕНТАРІ • 223

  • @takeUforward
    @takeUforward  4 роки тому +43

    Understood or nott? am waiting in the comment section ;)
    .
    Check me out at Instagram: instagram.com/striver_79/
    .
    If you appreciate the channel's work, you can join the family: bit.ly/joinFamily

    • @2018-y8t
      @2018-y8t 4 роки тому

      Yah ! understood

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

      speed is perfect as this series is focused on coming placements..understood..

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

      understood

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

      Understood bro! Thank you :)

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

      Understood!!!. Great work. Thanks for such a great channel. A few days back, I found this masterpiece channel named @take U forward. Now I am just following your SDE-PROBLEM sheet every day, and coding is like a daily routine for me.

  • @nayanikadeb4869
    @nayanikadeb4869 4 роки тому +128

    I have an honest confession to make. Before I found your channel, I didn't think product companies were for me. Tbh, I never had a clear picture as of how I should prepare for them . I wasn't into competitive programming at all. Yet, I am ambitious and want to do something good. It won't be so wrong to say you changed my life. If you see this comment, I want you to know what an amazing work you're doing. I wish I had found your channel in 1st year. Thank you so much! Lots of love and gratitude :)

    • @takeUforward
      @takeUforward  4 роки тому +15

      Welcome aboard as a subscriber, haha ! Thanks for the wonderful comment !

    • @Tarun-Mehta
      @Tarun-Mehta 3 роки тому +23

      Don’t worry , it’s never too late, I’m already in product based company, also having 6 + yrs of experiences, still learning 😇😇

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

      You got placed?

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

      @@Tarun-Mehta in which company ?

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

    Brute force approach in C++ {T(n) = O(n^2)} | if anybody is interested to know:
    Note:
    If you run submit this colution on Leetcode, the time exceed error comes, so need to optimize and submit.
    int n = prices.size();
    if(1 == n) return 0;
    int max_profit = 0;
    for(int i = 0; i < n; i++)
    {
    for(int j = i+1; j < n; j++)
    {
    max_profit = max(max_profit, prices[j] - prices[i]);
    }
    }
    return max_profit;

  • @manojpandey7517
    @manojpandey7517 4 роки тому +6

    at 2:45, we could also have traversed the array from the right side and keep track of maximum in right for every i.

    • @takeUforward
      @takeUforward  4 роки тому +4

      Yes similar to the minimum approach, both works fine !

  • @yuvrajoberoi7834
    @yuvrajoberoi7834 4 роки тому +28

    This was great. Also, this question has various variations of difficulty. If you could compile all the questions in 1 video then that would be great.

  • @shubhanshusingh8529
    @shubhanshusingh8529 2 роки тому +2

    Python solution (Accepted on Leetcode):
    Time Complexity: O(n)
    class Solution:
    def maxProfit(self, prices: List[int]) -> int:
    min_elem = prices[0]
    max_profit = 0
    if len(prices) == 1:
    return 0
    else:
    for index,item in enumerate(prices):
    if index > 0:
    diff = item - min_elem
    if diff < 0:
    min_elem = item
    continue
    else:
    max_profit = max(max_profit,diff)
    return max_profit

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

    Hi,
    First, he buys the stock at 1 and sells it at 5. Then again he buys at 3 and sells it again at 6, so the profit would be 5-1=4 and 6-3=3, a total of 7 right. but you got 5.
    I don't know is this a subversion of this problem, but heard this problem.

  • @architaganguly7712
    @architaganguly7712 4 роки тому +5

    Very helpful series. KEEP UP THE GOOD WORK!!
    Please upload the rest of the problems as well it would be really helpful.

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

    I think there is a flaw in the logic. Correct me if I'm wrong. For the scenario (20,50,10,30), the minimum would be taken as 10 and max profit will be calculated as 20 based on that. But a manual inspection shows that we shouldn't have switched the minimum from 20 to 10. The maximum profit is for buy at 20 and sell at 50. Making the max profit as 30.

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

      You cannot skip the day.

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

      @Polly10189, can you please elaborate?

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

      @@kaushiktlk consider this as buying in real life. On any current day, you can only compare with previous days and pick minimum. We cannot see in future if there will be minimum which is lesser than our current minimum or not. That's not possible. We have to pick minimum from the elements we have visited so far. And for this question, you can only buy once and sell once.

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

      ​@@Polly10189 if we should consider as a real life scenario where we cannot see into the future then we won't be able to know the real maximum at which we should sell. There is some inconsistency.

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

    This is in a way an application of Kadane's algorithm. First get the difference between current - previous. Then apply Kadane's algo on the result.

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

      Yes, that's absolutely correct!
      For those not familiar, Kadane's algorithm is a dynamic programming algorithm used to solve the maximum subarray problem, which is the task of finding the contiguous subarray with the largest sum in a one-dimensional array. The solution to the "Best Time to Buy and Sell Stock II" problem, where you can make as many transactions as you like, is somewhat similar to the maximum subarray problem.
      However, there's a slight but significant difference: In the stock problem, we want to find the maximum sum of all positive differences (i.e., all increases in price), regardless of whether they're contiguous or not, whereas in the maximum subarray problem, we're looking for the maximum sum of a contiguous subarray.
      When you calculate the difference array and apply Kadane's algorithm, you're finding the maximum sum of a contiguous subsequence of the difference array. This might not give you the correct answer for the stock problem because you're allowed to buy and sell on non-contiguous days as well.
      Therefore, the correct approach to the "Best Time to Buy and Sell Stock II" problem is to add up all positive differences, without requiring them to be contiguous. This is simpler than applying Kadane's algorithm, and guarantees that you get the correct answer.

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

    TC : O(N) and SC : O(1) .. c++ code
    class Solution {
    public:
    int maxProfit(vector& prices) {
    int profit=0;
    int mini=INT_MAX;
    int ans=INT_MIN;
    int n=prices.size();
    for(int i=0;itemp){
    mini=temp;
    }
    profit=prices[i]-mini;
    if(profit>ans){
    ans=profit;
    }
    }
    return ans;
    }
    };

  • @javi2082
    @javi2082 4 роки тому +2

    What are the most common Stock Buy Pattern?Variation questions?
    One is to find the max profit, another is to find total profit. Can you people suggest more??

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

    i think max ans for the explaned array should be 7, buy at 1 sell at 5 profit 4 now buy at 3 and sell at 6 profit 3, total profit 7

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

      This is a single transaction only problem.

  • @lakshmimanasamvs7833
    @lakshmimanasamvs7833 4 роки тому +1

    Please make a video on "n stocks buying and selling"

  • @mukulbindal2303
    @mukulbindal2303 4 роки тому +9

    Striver bro 😂😂kahi aisa na ho ki inn videos ki popularity dekh ke faang nye concepts se interview lene lge. ie system design, db etc se😅😅

  • @KoushikS-s3n
    @KoushikS-s3n Рік тому

    small correction in required,
    because I can buy at 1 and sell for 5, then buy for 3 and sell for 6,
    then my profit is 7 which is max profit.

  • @SudhanshuKumar-jl8iw
    @SudhanshuKumar-jl8iw 4 роки тому +7

    Nice explaination,We need mentors like you to understand these concept so easily.I had started preparing after a lot of failure might this time i got success ,I am trying to following all the startegy which you had shared to get into a big company.

  • @ashaykoradia2475
    @ashaykoradia2475 4 роки тому +5

    Me and my boiss after solving this question...
    Harshhod mehhta😎

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

    More clean code
    class Solution {
    public int maxProfit(int[] prices) {
    int max=0;
    int min = prices[0];
    for(int i=1;i

  • @AmitKumar-cu1vx
    @AmitKumar-cu1vx 2 роки тому +1

    I got this question in OYO campus placement test

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

    Optimal Approach makes so much sense.

  • @ishanshah3309
    @ishanshah3309 4 роки тому +1

    Hello you are doing amazing job. I have one question what if in question instead of one transaction there are unlimited transactions are allowed ? Can you please give me a hint or brief idea ?

  • @aXe-XBT
    @aXe-XBT 4 роки тому +2

    Great explanation brother. I implemented the solution using dictionaries (Python) and my logic is also working great, but there is an error in my code which I am unable to debug, could you please guide me?
    Thanks in advance
    EDIT: MY CODE IS FIXED BUT TAKES 5008ms TO RUN, IS IT GOOD?

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

    Initially, I solve from the back of the array and got WA on some test cases then tried front View and yeh got it👍👍
    Point here I understood after doing this kind of problems is that 👉NEVER GO TOO COMPLICATED 👈 😅😅

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

      Actually I also did from the rear end of array . That also works . See..
      //code begins here
      int n=prices.size();
      int maxp=prices[n-1];
      int ans=0;
      for(int i=n-2;i>=0;i--)
      {
      ans=max(maxp-prices[i],ans);
      maxp=max(maxp,prices[i]);
      }

      return ans;

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

    @takeuforward if I submit this code with O(n) complexity on leetcode, it says slower than 94% of Cpp solutions
    class Solution {
    public:
    int maxProfit(vector& prices) {
    int mini = INT_MAX;
    int profit = 0;
    for(int i = 0; i mini){
    profit = max(profit, prices[i] - mini);
    }
    else{
    mini = min(mini,prices[i]);
    }
    }
    return profit;
    }
    };
    When I look for other's optimized solutions they also have O(n) solution which is 8x times less time-consuming....
    Please clarify it??

    • @takeUforward
      @takeUforward  4 роки тому +1

      Lot of factors involved, like server speed and other factors like if else etc. Minute factors, ignore and focus on logic

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

      @@takeUforward Thanks

  • @pirangitharun8736
    @pirangitharun8736 3 роки тому +1

    This is something like kadane's algorithms right?

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

    Is the second approach a DP aaproach? like Kadanes Algo

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

    UNDERSTOOD...!
    Thanks striver for the video... :)

  • @ayushthakur733
    @ayushthakur733 4 роки тому +3

    i must say this series is super helpful and I'm loving your explanation , please upload faster 4-5 que a day ...so that we can maintain our pace :-)

    • @takeUforward
      @takeUforward  4 роки тому +8

      Not possible bro.. am a working guy !

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

      @@takeUforward bhaiya it will 180 days like this please just make it 2-3 😶

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

    TC O(N^2)
    BRUTEFORCE :
    #include
    using namespace std;
    int main()
    {
    //int arr[]= {7,6,4,3,1};
    int n=sizeof(arr)/sizeof(arr[0]);
    int maxi=-23443322;
    if(n==1)
    {
    cout

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

      int maxProfit(vector& arr) {
      int maxi=-23443322;
      for(int i=0;i

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

    One of the best lecture which I saw in Utube

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

    Y minprice is initialize with INT_MAX;

  • @SHUBHAMKUMAR-mt7zx
    @SHUBHAMKUMAR-mt7zx 4 роки тому +1

    Understand very well🤗

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

    Your explanation is really good.
    and differnt approach to do same problem, makes it awsm

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

    // A cleaner Java version
    class Solution {
    public int maxProfit(int[] prices) {
    int min = Integer.MAX_VALUE;
    int profit = 0;
    for (int p : prices) {
    min = Math.min(p, min);
    profit = Math.max( profit, p - min);
    }
    return profit;
    }
    }

  • @vaibhavchawla7353
    @vaibhavchawla7353 4 роки тому +1

    Do we update the minimum if we get some mimimum value?

    • @takeUforward
      @takeUforward  4 роки тому +2

      Yes..

    • @vaibhavchawla7353
      @vaibhavchawla7353 4 роки тому +1

      What if the input is 7, 4, 6, 1, 2?

    • @vaibhavchawla7353
      @vaibhavchawla7353 4 роки тому +1

      For 4 the profit will be 2 but if we change the minimum to 1 again then the profit will be 1.

    • @takeUforward
      @takeUforward  4 роки тому +4

      @@vaibhavchawla7353 buy at 4 sell at 6, that will the max profit.. next time when the minimal is 1, you get 2, but that profit will be 1.

    • @vaibhavchawla7353
      @vaibhavchawla7353 4 роки тому +1

      @@takeUforward ok ok got it. 👌👍

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

    Thank you sir

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

    if you are solving this then do also solve the other 4 versions of the problem

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

    Such an elegant solution!

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

    Nice question.. I understood.

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

    Quite an easy fix one ....Keep going bhai...grt work ....👌👌👌

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

    Ye toh jayada hi aasan tha yaar..
    Understood❣️❣️

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

    The bruteforce solution you taught here will not work. Check gfg's bruteforce solution for this.

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

    Can't we allow multiple buying and selling

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

    amazing describe sir thank you

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

    why min value is not changing i dont understand

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

    I have a doubt Bhaiya, why didn't you use if-else in CPP soln, like you did in your Java soln?

    • @takeUforward
      @takeUforward  4 роки тому +1

      An approach can be written in multiple ways,

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

    Understood. ❤️ .. you are the best. 💯💯

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

    understood it very well...thanks bhaiya

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

    129 likes 0 dislikes that's insane bro keep up the good work

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

    Great solution

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

    Bhaiya can you please discuss the soln, for what happens if we can (sell and purchase) each transaction atmost k times and you must sell the stock before you buy the next stock

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

      If the problem is extended to allow up to k transactions, the complexity increases, but it can still be solved using dynamic programming.
      You'll need a two-dimensional array `profit[t][d]`, where `t` is the transaction index (from 0 to k) and `d` is the day index (from 0 to the number of days - 1). `profit[t][d]` represents the maximum profit we can get by making at most `t` transactions up to day `d`.
      You can initialize `profit[t][0]` to 0 for all `t` (since you can't make a profit on the first day), and `profit[0][d]` to 0 for all `d` (since you can't make a profit with 0 transactions).
      Then, you'll iterate over `t` and `d` to fill in the rest of the `profit` array. For each pair `(t, d)`, you have two options:
      1. Don't make a transaction on day `d`. In this case, the profit is the same as it was on the previous day, i.e., `profit[t][d - 1]`.
      2. Sell a stock on day `d`. In this case, you need to find the day to buy the stock that maximizes the profit. Let's call this day `d'`. You buy on day `d'` and sell on day `d`, and you also get the profit from making `t - 1` transactions up to day `d' - 1`. This gives you a profit of `prices[d] - prices[d'] + profit[t - 1][d' - 1]`. You'll take the maximum over all possible `d'` (from 0 to `d - 1`).
      So, you'll fill in `profit[t][d]` as `max(profit[t][d - 1], prices[d] - prices[d'] + profit[t - 1][d' - 1] for all d' in [0, d - 1])`.
      Finally, the maximum profit you can get is `profit[k][n - 1]`, where `n` is the number of days.
      This solution has a time complexity of O(k*n^2) because for each pair `(t, d)`, it iterates over `[0, d - 1]` to find the best day `d'` to buy the stock.
      The time complexity can be reduced to O(k*n) by keeping track of the maximum value of `prices[d'] - profit[t - 1][d' - 1]` for all `d'` in `[0, d - 1]`, and updating it for each `d`. This value represents the maximum profit you can get by ending your `t - 1`th transaction on or before day `d' - 1` and starting your `t`th transaction on day `d'`.
      Here is the pseudo code for this:
      ```python
      function maxProfit(prices, k):
      n = len(prices)
      if k > n / 2:
      return quickSolve(prices) # quickSolve() is the function for unlimited transactions
      profit = [[0]*n for _ in range(k+1)]
      for t in range(1, k+1):
      maxDiff = -prices[0]
      for d in range(1, n):
      profit[t][d] = max(profit[t][d - 1], prices[d] + maxDiff)
      maxDiff = max(maxDiff, profit[t - 1][d - 1] - prices[d])
      return profit[k][n - 1]
      ```
      In this code, `maxDiff` is the maximum value of `profit[t - 1][d' - 1] - prices[d']` for all `d'` in `[0, d - 1]`. We update `maxDiff` for each `d` to ensure that it always represents the best day `d'` to buy the stock for the current transaction and day.

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

    what if we are allowed to choose any number of time

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

    but what if we want to get all the options to get max profit printed ?

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

      To print all the transaction options for maximum profit, we need to slightly modify our approach. Along with tracking the maximum profit, we need to also track the decisions we made at each point.
      After computing the maximum profit table, you can backtrack from `profit[k][n-1]` to find the transactions. If `profit[t][d]` is not equal to `profit[t][d - 1]`, it means we made a transaction on day `d`. We can then find the day `d'` we bought the stock by searching for `d'` such that `prices[d] - prices[d'] + profit[t - 1][d' - 1]` equals `profit[t][d]`. This is essentially the inverse of the computation we did to fill in the `profit` array.
      This approach can be quite complex and time-consuming because for each transaction, you have to search for the day you bought the stock. An alternative approach is to store the decisions directly in another array during the dynamic programming step.
      Here is a rough pseudo code for the entire approach:
      ```python
      function maxProfit(prices, k):
      n = len(prices)
      if k > n / 2:
      return quickSolve(prices) # quickSolve() is the function for unlimited transactions
      profit = [[0]*n for _ in range(k+1)]
      decision = [[0]*n for _ in range(k+1)] # new decision array
      for t in range(1, k+1):
      maxDiff = -prices[0]
      for d in range(1, n):
      if prices[d] + maxDiff > profit[t][d - 1]:
      profit[t][d] = prices[d] + maxDiff
      decision[t][d] = d # store the decision of making a transaction on day d
      else:
      profit[t][d] = profit[t][d - 1]
      maxDiff = max(maxDiff, profit[t - 1][d - 1] - prices[d])
      # backtracking to find the transactions
      transactions = []
      d = n - 1
      for t in range(k, 0, -1):
      if decision[t][d] != 0: # if we made a transaction on day d
      buy_day = decision[t][d]
      sell_day = d
      transactions.append((buy_day, sell_day)) # add the transaction to the list
      d = buy_day - 1 # move to the day before we bought the stock
      return profit[k][n - 1], transactions[::-1] # reverse the transactions list to get them in chronological order
      ```
      This code will return the maximum profit as well as the list of transactions. Each transaction is a pair `(buy_day, sell_day)` indicating the day you bought the stock and the day you sold it.
      Please note that this pseudo code is simplified and assumes perfect inputs, so you should add your own error checking and edge case handling where necessary.

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

    Answer is Seven

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

    Thanks for the amazing explaination😊

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

    Bhaiya thanks a lot for such a good content!
    Bhaiya is question ke i think 6 variants hai kya please aap vo bhi discuss kr skte ho, thanks!!

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

    this is pretty similar to kadanes algo

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

    Understood
    THANKS for everything ❤️❤️

  • @UdayKumar-pm3jn
    @UdayKumar-pm3jn 2 роки тому

    Thank you for the wonderful series bro

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

    If we give brute force first then optimal, won’t the interviewer say pata tha to pehle kyu nahi bataya (I’m genuinely asking, does this happen?)

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

      Haha same question 😭😭😂

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

      @@vagabondfoodie5788 no, by the time I realised, this is the correct process, first brute force then optimal

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

    Understand

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

    Nice explanation ❤

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

    you are doing a good job man !

  • @karthikeyan-hz8sw
    @karthikeyan-hz8sw 3 роки тому

    Man.. Thanks.. Subscribed

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

    Superb Explanation!!

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

    understood

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

    thank you

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

    how to initialize mini to some big integer in python ?

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

    You are the best !!!

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

    Thankyou for this explanation

  • @adityamahimkar6138
    @adityamahimkar6138 4 роки тому +1

    Understood 💯

  • @AbhishekSingh-fc2rx
    @AbhishekSingh-fc2rx 4 роки тому

    nicely explained sir

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

    Understood bhaiya

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

    Understood bro👍👍👍👍
    Thanks bro

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

    Helping a lot,
    may all your dreams will happen

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

      But one question, this is solved by u or some one ..., I ask one thing all the optimised solutions thought in your mind or took from some where,
      Becoz I want to analyze my IQ, I didnt get any optimal solutions in my mind ,am I able to crack amazon

    • @takeUforward
      @takeUforward  4 роки тому +1

      Sometimes it comes, sometime I understand!

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

      @@takeUforward thanks bhai

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

    Thank you Striver :)

  • @616_jyotidikshit2
    @616_jyotidikshit2 3 роки тому

    U R BEST!

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

    Great work, bro!

  • @isms-7
    @isms-7 3 роки тому

    thank u striver

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

    Awesome explanation bhaiya...Thanks a lot for providing great content and keep going and stay safe bhaiya.

  • @paawansingal788
    @paawansingal788 4 роки тому +2

    loving your series :-) thanks a lot

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

      No no someone else did :P

    • @paawansingal788
      @paawansingal788 4 роки тому +1

      @@takeUforward next time se i will be first xD, without watching video becoz video to app acchi banaoge hi :)

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

    Understood! Kudos for waiting me 🤣

  • @sanbidrc
    @sanbidrc 3 роки тому +1

    Kadanes Algorithm !

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

    understood bhaiya

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

    awesome explanation 😍

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

    Thank you bro 💯💯

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

    thank you so much bhaiya
    you are a inspiration for me

  • @remmargorpp
    @remmargorpp 4 роки тому +1

    bool understood = true ;p

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

    Commenting for reach

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

    thanku bhai u are great

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

    US!!!

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

    Understood

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

    Thanks bhai :)
    Love u
    Wishes

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

    Thank you bhaiya

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

    Nice

  • @AmanKhan-bw3rt
    @AmanKhan-bw3rt 4 роки тому

    super 👌

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

    Thanks for amazing video bhaiya

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

    is this a example of backtracking

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

    cool