Home
Gaurav's GitHub Page
Cancel

BFS of graph (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a directed graph. The task is to do Breadth First Traversal of this graph starting from 0. geeksforgeeks SOLUTION We use a queue to explore nodes level by level, marki...

Minimum sum partition (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr of size n containing non-negative integers, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum ...

Snake and Ladder Problem (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a 5x6 snakes and ladders board, find the minimum number of dice throws required to reach the destination or last cell (30th cell) from the source (1st cell). You are giv...

Egg Dropping Puzzle (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given N identical eggs and you have access to a K-floored building from 1 to K. There exists a floor f where 0 <= f <= K such that any egg dropped from a floor h...

Floyd Warshall (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION The problem is to find the shortest distances between every pair of vertices in a given edge-weighted directed graph. The graph is represented as an adjacency matrix of size nx...

Max Sum Increasing Subsequence (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of n positive integers. Find the sum of the maximum sum subsequence of the given array such that the integers in the subsequence are sorted in strictly increasin...

Partition Equal Subset Sum (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr[] of size N, check if it can be partitioned into two parts such that the sum of elements in both parts is the same. geeksforgeeks SOLUTION BRUTE-FORCE (TL...

Longest Common Subsequence (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two strings str1 & str 2 of length n & m respectively, return the length of their longest common subsequence. If there is no common subsequence then, return 0. A...

Longest Increasing Subsequence (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array a[ ] of n integers, find the Length of the Longest Strictly Increasing Subsequence. A sequence of numbers is called “strictly increasing” when each term in the ...

Count number of hops (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION A frog jumps either 1, 2, or 3 steps to go to the top. In how many ways can it reach the top of Nth step. As the answer will be large find the answer modulo 1000000007. geeksf...