Sliding Window Approach | Longest Continuous Increasing Subsequence | LeetCode 674.

Поділитися
Вставка
  • Опубліковано 18 вер 2024
  • The Best Place To Learn Anything Coding Related - bit.ly/3MFZLIZ
    Join my free exclusive community built to empower programmers! - www.skool.com/...
    Preparing For Your Coding Interviews? Use These Resources
    --------------------
    (My Course) Data Structures & Algorithms for Coding Interviews - thedailybyte.d...
    AlgoCademy - algocademy.com...
    Daily Coding Interview Questions - bit.ly/3xw1Sqz
    10% Off Of The Best Web Hosting! - hostinger.com/...
    Follow Me on X/Twitter - x.com/nickwhit...
    Follow My Instagram - / nickwwhite
    Other Social Media
    ----------------------------------------------
    Discord - / discord
    Twitch - / nickwhitettv
    TikTok - / nickwhitetiktok
    LinkedIn - / nicholas-w-white
    Show Support
    ------------------------------------------------------------------------------
    Patreon - / nick_white
    PayPal - paypal.me/nick....
    Become A Member - / @nickwhite
    #coding #programming #softwareengineering

КОМЕНТАРІ • 31

  • @Madeinchinaagain
    @Madeinchinaagain 4 роки тому +12

    Playlist Request: All problem solutions by Nick White that implement sliding window

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

      Do you guys really think people fall for these?

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

    Hello there, Nick. I'm one of your more recent subscribers! Pretty neat channel! Hey, while we're on the topic of Sliding Window, Do you think you could explain Why LeetCode #560 Can not be solved with a Sliding Window Technique? Thank you very much, sir.

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

    Thanks Nick for great explanation !

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

    you're unmatchable

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

    I think this can also be solved using stacks using the idea next greatest index to the right and keep track of stack size during each iteration

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

    Can you please make a video when the array is non contiguous 🙏♥️

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

    Thanks sir its all so beneficial for us, keep doing....

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

    I think the question says subarray. Since the subsequences aren't necessarily contiguous.

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

    Dude, this is more of closing a window and opening another window than sliding window. You only got one pointer, for sliding window u need 2

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

    such a smooth answer

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

    wow I knew of this concept but did not know of the "sliding window" name

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

    Also, suppose if I want to find the Longest Common Subsequence consider increasing subsequence then how to use a sliding approach ?? Is it gonna return quadratic time complexity since I will need two for loops to iterate over two strings?

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

    Then how to print the subsequence? 🤔 I tried but didn't work

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

      Did you find the solution? print the longest continuous increasing number?

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

    remember u had that im bloomberg contest ?

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

    please help me !! print the longest continuous increasing number?

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

    thank you

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

    why do you need the && i > 0 in the if condition? it seems obsolete

    • @Lee-mp5vg
      @Lee-mp5vg Рік тому

      keep the boundary to stay in the loop

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

      segmentation fault since for i=0 it will compare to i-1 i.e 0-1, which is out of index;

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

    Flexport rejected me unbelievable

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

    Not explained all details,

  • @Rob-J-BJJ
    @Rob-J-BJJ 10 місяців тому

    Interesting perhaps someone can hep me, I have this code class Solution {
    public int findLengthOfLCIS(int[] nums) {
    if (nums.length == 1) {
    return 1;
    }
    int maxCount = 1;
    int maxSum = nums[0];
    int currSum = nums[0];
    int L = 0, R = 1, N = nums.length;
    while (R < N) {
    if (nums[R - 1] < nums[R]) {
    currSum += nums[R];
    if (currSum > maxSum) {
    maxCount = Math.max(maxCount, R - L + 1 );
    maxSum = currSum;
    R++;
    } else {
    }
    } else {
    L = R;
    R++;
    currSum = nums[L];
    }
    }
    return maxCount;
    }
    }
    but I'm getting a TLE.

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

    Great👍(

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

    quick question: when we do nums[i-1] >= nums[i] the for loop starts at 0 -- so i - 1 = -1? so I'm a bit confused how this code is working? Shouldn't I try to start my loop from 1 instead? I tried that in python and its giving me error.

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

      There's also i>0 condition in his if statement.