Samual Sam has Published 1776 Articles

Minimum Cost Polygon Triangulation

Samual Sam

Samual Sam

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

960 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

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

416 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

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

524 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

Box Stacking Problem

Samual Sam

Samual Sam

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

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

Longest Path in a Directed Acyclic Graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 12:46:03

2K+ Views

One weighted directed acyclic graph is given. Another source vertex is also provided. Now we have to find the longest distance from the starting node to all other vertices, in the graph.We need to sort the nodes in topological sorting technique, and the result after the topological sort is stored ... Read More

Shortest path with exactly k Edges

Samual Sam

Samual Sam

Updated on 16-Jun-2020 12:34:11

696 Views

One directed graph is provided with the weight between each pair of vertices, and two vertices u and v are also provided. Our task is to find the shortest distance from vertex u to vertex v, with exactly k number of edges. To solve this problem, we will start from vertex ... Read More

Connectivity in a directed graph

Samual Sam

Samual Sam

Updated on 16-Jun-2020 11:35:48

3K+ Views

To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any node, which is not visited, then the graph is not connected.For the directed graph, we will start traversing from all nodes to check connectivity. Sometimes ... Read More

Advertisements