## Bellman Ford Algorithm (Simple Implementation)

We have introduced Bellman Ford and discussed on implementation here. Input: Graph and a source vertex src Output: Shortest distance to all vertices from src.… Read More »

- Check if a word exists in a grid or not
- Sum of XOR of all subarrays
- Minimum steps to reach any of the boundary edges of a matrix | Set 1
- Longest subsequence such that adjacent elements have at least one common digit
- Make Binary Search Tree
- Samsung Interview Experience through Co-cubes (2019)
- Minimum distance to the end of a grid from source
- Color N boxes using M colors such that K boxes have different color from the box on its left
- Double Knapsack | Dynamic Programming
- Minimum steps required to convert X to Y where a binary matrix represents the possible conversions
- Longest path in a directed Acyclic graph | Dynamic Programming
- Optimal Strategy for a Game | Set 2
- A variation of Rat in a Maze : multiple steps or jumps allowed
- Find the number of distinct pairs of vertices which have a distance of exactly k in a tree
- Maximum subarray sum by flipping signs of at most K array elements
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Count of Numbers in Range where first digit is equal to last digit of the number
- Bellman Ford Algorithm (Simple Implementation)
- Count pairs of non-overlapping palindromic sub-strings of the given string
- Find sub-matrix with the given sum
- Minimum steps to delete a string by deleting substring comprising of same characters
- Minimum cost to reach end of array array when a maximum jump of K index is allowed
- Count of sub-sets of size n with total element sum divisible by 3
- Count number of ways to reach a given score in a Matrix
- Sum of bitwise AND of all submatrices
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Number of Binary Strings of length N with K adjacent Set Bits
- Find the sum of the diagonal elements of the given N X N spiral matrix
- Number of ways of scoring R runs in B balls with at most W wickets

We have introduced Bellman Ford and discussed on implementation here. Input: Graph and a source vertex src Output: Shortest distance to all vertices from src.… Read More »

Given an array arr[] of size N, the task is to count the number of ways we can select a subset from the given array… Read More »

Given an integer n, the task is to find the minimum number of cubes whose sum equals to N. Examples: Input: N = 496 Output:… Read More »

Given an array arr[] of N integers and an integer X. We can choose any sub-array and multiply all its element by X. After multiplication,… Read More »

Given an array arr[] of integers, the task is to find the minimum number greater than the maximum element from the array which cannot be… Read More »

Given a string S. The task is to count the non-overlapping pairs of palindromic sub-strings S1 and S2 such that the strings should be S1[L1…R1]… Read More »

Given a string str and Q queries. Every query consists of two numbers L and R. The task is to print if the sub-string[L…R] is… Read More »

Given an array arr[] of size N. The task is to find the length of the longest subsequence from the given array such that the… Read More »

Given an integer N. The task is to find the number of all possible distinct binary strings of length N which have at least 3… Read More »

Given N which is the size of the N X N spiral matrix of the form: 16 15 14 13 5 4 3 12 6… Read More »

Given a tree with n nodes and a number associated with every node. We can break any edge of the tree which will result in… Read More »

Given an array arr[] of integer elements, the task is to find maximum possible sub-array sum after changing the signs of at most two elements.… Read More »

Given a N-ary tree with a value associated with each node, the task is to choose a subset of these nodes such that sum of… Read More »

Given a binary tree, the task is to find the Lowest Common Ancestor of the given two nodes in the tree. Let G be a… Read More »

Given a N x N matrix mat[][] consisting of non-negative integers, the task is to find the number of ways to reach a given score… Read More »