Logo Fateh's Blog
  • Home
  • About
  • Skills
  • Work History
  • Education
  • More
    Education Featured Posts Recent Posts Achievements
  • Posts
  • Notes
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Posts
  • CS Nerd Posts
    • Leetcode
      • 1143. Longest Common Subsequence
      • 300. Longest Increasing Subsequence
      • 673. Number of Longest Increasing Subsequence
      • Useful Python Libraries & Modules
  • Math Posts
    • Github Pages
  • Miscellaneous
  • Analytics & Comments
Hero Image
Useful Python Libraries & Modules

Bisect Reference Incredible module for inserting and searching an array for values using a binary search Useful methods include: bisect.bisect(arr, val) - searches for the value in the array and returns an insertion point coming after any existing entries of the value bisect.bisect_left - searches for the value of the array and returns insertion point to the left of it bisect.bisect_right - same as bisect_left but for insertions to the right bisect.

    Saturday, July 27, 2024 | 1 minute Read
    Hero Image
    673. Number of Longest Increasing Subsequence

    Today we are finding the number of longest increasing subsequences in an integer array. Approach Since this involves finding the maximum length of something, we can make a good guess that it is a DP problem. Moreover, it does not look like we can use a two pointer greedy approach since there are multiple sequences to be found and they can be spaced out all over the array. Instead, we need to look at the problem deeper to see if there is some kind of recurrence to be exploited.

      Wednesday, July 3, 2024 | 1 minute Read
      Hero Image
      300. Longest Increasing Subsequence

      Here we solve 300. Longest Increasing Subsequence. It asks us for the length of the longest strictly increasing subsequence in an array. So, for the array [3, 2, 6, 2, 9, 2, 7, 1, 4, 2, 15, 16, 14, 18, 1], the answer would be 6, one of such arrays being [2, 6, 7, 15, 16, 18]. Solution We solve this problem by iteratively building a subsequence from left to right, obeying the following rules:

        Wednesday, June 19, 2024 | 2 minutes Read
        Hero Image
        1143. Longest Common Subsequence

        To kickstart my blog on solving leetcode problems which I deem to be worthy of a writeup (most of them since I usually end up forgetting my approach), let’s look at this classic question. The question asks, given two strings sss and ttt, what is the longest subsequence between them? For our example, let’s use s="abcdef" and b="bcdgf". The longest common subsequence should then be bcdf. I liken this problem to a Hydra, since it is very easy to get confused by it again even after you solve it.

          Wednesday, June 12, 2024 | 2 minutes Read
          Navigation
          • About
          • Skills
          • Work History
          • Education
          • Projects
          • Featured Posts
          • Recent Posts
          • Achievements
          Contact me:
          • [email protected]
          • fatehss
          • Fateh Sandhu
          • +1 (709) 293-2394

          Liability Notice: This theme is under MIT license. So, you can use it for non-commercial, commercial, or private uses. You can modify or distribute the theme without requiring any permission from the theme author. However, the theme author does not provide any warranty or takes any liability for any issue with the theme.


          Toha Theme Logo Toha
          © 2020 Copyright.
          Powered by Hugo Logo