Samual Sam has Published 2492 Articles

Maximum size square submatrix with all 1s

Samual Sam

Samual Sam

Updated on 17-Jun-2020 07:11:23

238 Views

When a binary matrix is given, our task is to find a square matrix whose all elements are 1.For this problem, we will make an auxiliary size matrix, whose order is the same as the given matrix. This size matrix will help to represent, in each entry Size[i, j], is ... Read More

Minimum Cost Polygon Triangulation

Samual Sam

Samual Sam

Updated on 17-Jun-2020 06:56:14

597 Views

When nonintersecting diagonals are forming a triangle in a polygon, it is called the triangulation. Our task is to find a minimum cost of triangulation.The cost of triangulation is the sum of the weights of its component triangles. We can find the weight of each triangle by adding their sides, ... Read More

Minimum Initial Points to Reach Destination

Samual Sam

Samual Sam

Updated on 17-Jun-2020 06:54:13

782 Views

To start from the top-left corner of a given grid, one has to reach the bottom-right corner. Each cell in the grid contains a number, the number may positive or negative. When the person reaches a cell (i, j) the number of tokens he has, may be increased or decreased ... Read More

How to print maximum number of A’s using given four keys

Samual Sam

Samual Sam

Updated on 16-Jun-2020 15:47:10

181 Views

Let us consider, we will try to write the letter ‘A’, using the keyboard. Our goal is to use only four keys and try to write maximum ‘A’s on the text field. The keys are ‘A’, ‘C’, ‘V’ and ‘Ctrl’.To write the maximum number of A, we will use Ctrl ... Read More

Compute sum of digits in all numbers from 1 to n

Samual Sam

Samual Sam

Updated on 16-Jun-2020 15:15:00

602 Views

In this problem, we have to find the sum of digits of all numbers in range 1 to n. For an example the sum of digits of 54 is 5 + 4 = 9, Like this, we have to find all the numbers and their sum of digits.We know that ... Read More

Count ways to reach the n’th stair

Samual Sam

Samual Sam

Updated on 16-Jun-2020 14:45:40

286 Views

There are n stairs. One person will go to 1'st to the n'th stair. Maximum how many stairs he/she can cross in one step is also given. With this information, we have to find possible ways to go to the n'th stairs.Let us consider one can cross a maximum two ... Read More

Find numbers whose sum of digits equals a value

Samual Sam

Samual Sam

Updated on 16-Jun-2020 14:28:01

987 Views

There are a number n and a value. We have to find all n digit numbers, where the sum of all n digit the s is the same as the given value. Here 0 is noa t counted as a digit.The number n must be in the range 1 to ... Read More

Tarjan's Algorithm for Strongly Connected Components

Samual Sam

Samual Sam

Updated on 16-Jun-2020 14:09:17

2K+ Views

Tarjan’s Algorithm is used to find strongly connected components of a directed graph. It requires only one DFS traversal to implement this algorithm.Using DFS traversal we can find DFS tree of the forest. From the DFS tree, strongly connected components are found. When the root of such sub-tree is found ... Read More

Ford Fulkerson Algorithm

Samual Sam

Samual Sam

Updated on 16-Jun-2020 14:01:32

4K+ Views

The Ford-Fulkerson algorithm is used to detect maximum flow from start vertex to sink vertex in a given graph. In this graph, every edge has the capacity. Two vertices are provided named Source and Sink. The source vertex has all outward edge, no inward edge, and the sink will have ... Read More

Box Stacking Problem

Samual Sam

Samual Sam

Updated on 16-Jun-2020 13:33:48

722 Views

In this problem a set of different boxes are given, the length, breadth, and width may differ for different boxes. Our task is to find a stack of these boxes, whose height is as much as possible. We can rotate any box as we wish. But there is a rule ... Read More

Advertisements