## Python Program for Longest Common Subsequence

LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in… Read More »

- Check if a word exists in a grid or not
- Minimum steps to reach any of the boundary edges of a matrix | Set 1
- Sum of XOR of all subarrays
- Count ways to reach a score using 1 and 2 with no consecutive 2s
- Make Binary Search Tree
- Treasure and Cities
- Number of ways to partition a string into two balanced subsequences
- Memoization using decorators in Python
- Color N boxes using M colors such that K boxes have different color from the box on its left
- Jump Pointer Algorithm
- Minimum distance to the end of a grid from source
- Minimum steps required to convert X to Y where a binary matrix represents the possible conversions
- Minimum cost to reach a point N from 0 with two different operations allowed
- A variation of Rat in a Maze : multiple steps or jumps allowed
- Count of Numbers in Range where first digit is equal to last digit of the number
- Count of sub-sets of size n with total element sum divisible by 3
- Minimum sum falling path in a NxN grid
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Ways to place K bishops on an N×N chessboard so that no two attack
- Find sub-matrix with the given sum
- Number of Binary Strings of length N with K adjacent Set Bits
- Find the sum of first N odd Fibonacci numbers
- Minimum Operations to make value of all vertices of the tree Zero
- Number of balanced bracket expressions that can be formed from a string
- Minimum number of operations required to sum to binary string S
- Count of Numbers in a Range where digit d occurs exactly K times
- Count pairs (A, B) such that A has X and B has Y number of set bits and A+B = C
- Count the number of special permutations
- Count of Numbers in Range where the number does not contain more than K non zero digits
- Number of Paths of Weight W in a K-ary tree

LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in… Read More »

We have discussed Overlapping Subproblems and Optimal Substructure properties in Set 1 and Set 2 respectively. We also discussed one example problem in Set 3.… Read More »

The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the… Read More »

We have discussed Overlapping Subproblems and Optimal Substructure properties. Let us discuss Longest Increasing Subsequence (LIS) problem as an example problem that can be solved… Read More »

As we discussed in Set 1, following are the two main properties of a problem that suggest that the given problem can be solved using… Read More »

Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and stores the results of subproblems to avoid… Read More »

The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..… Read More »

Total number of possible Binary Search Trees with n different keys (countBST(n)) = Catalan number Cn = (2n)!/(n+1)!*n! For n = 0, 1, 2, 3,… Read More »

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

Given an array of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be… Read More »

Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12,… Read More »

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »