Samual Sam has Published 2310 Articles

Break Number Into 3 parts to find max sum

Samual Sam

Samual Sam

Updated on 17-Jun-2020 07:33:43

564 Views

A number is given. Our task is to break the number three times by n/2, n/3, and n/4 and find maximum sum we can make by dividing the number into three parts.For an example, 50 can be divided into {25, 16, 12}, now break each of the set {25, 16, ... Read More

Wildcard Pattern Matching

Samual Sam

Samual Sam

Updated on 17-Jun-2020 07:27:53

2K+ Views

For this problem, one main string and another wildcard patterns are given. In this algorithm, it will check whether the wildcard pattern is matching with the main text or not.The wildcard pattern may contain letters or ‘*’ or ‘?’ Symbols. The ‘?’ Is used to match a single character and ... Read More

Maximum size square submatrix with all 1s

Samual Sam

Samual Sam

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

437 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

849 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

988 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

350 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

935 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

434 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

1K+ 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

Advertisements