334. Increasing Triplet Subsequence - Day 11/31 Leetcode October Challenge

Ғылым және технология

Larry solves and analyzes this Leetcode problem as both an interviewer and an interviewee. This is a live recording of a real engineer solving a problem live - no cuts or edits!
Problem: leetcode.com/problems/increas...
Twitch: / larryny
Discord: / discord
Instagram: / larrysomewhere
#leetcode #coding #programming

Пікірлер: 9

  • @Algorithmist
    @Algorithmist Жыл бұрын

    Were you able to get increasing?

  • @narolavarshil6067

    @narolavarshil6067

    Жыл бұрын

    I did with minpref and maxsuf with n time and n space.. But your explanation was amazing doing question with maximum length of increasing subsequence way which was asked in recent contest

  • @PulIoFF
    @PulIoFF Жыл бұрын

    Such a tricky solution. First I thought it’s wrong because we change the first number and leave the second one, so the index order might be wrong. But then I tried couple of test cases in mind and understood that since we need to return just boolean number, that solution works fine. Thanks!

  • @datawithcarter
    @datawithcarter Жыл бұрын

    Agh! Just had to keep track of the smallest and second smallest numbers.. This helped a lot - thanks Larry! 😄

  • @incubo4u555
    @incubo4u555 Жыл бұрын

    please don't ever stop recording these daily 🙏❤

  • @nitz135
    @nitz1357 ай бұрын

    This was really helpful, thank you so much!

  • @oussamazoumi9280
    @oussamazoumi9280 Жыл бұрын

    This was so helpful!! Thank you

  • @mrlectus
    @mrlectus6 ай бұрын

    what if it is Increasing 4 Subsequence, how would the algorithm change?

  • @narolavarshil6067
    @narolavarshil6067 Жыл бұрын

    N=len(nums) arr=[nums[0]] for i in range(1,N): x=nums[i] if x>arr[-1]: arr.append(x) else: index=bisect.bisect_left(arr,x) arr[index]=x if len(arr)>2: return True return False #above code using longest increasing subsequence problem with O(N) time and O(1) space

Келесі