Found 202 Articles for Dynamic Programming

Collect maximum points in a grid using two traversals

Arjun Thakur
Updated on 16-Jun-2020 15:18:04

336 Views

There is a matrix with points in each cell, how to get maximum points from that grid using two traversals.There is some condition to satisfy −The first traversal starts from the top left cell in the grid and should go to the bottom left corner.      And in the second traversal starting from top right corner to bottom right cornerFrom one cell we can only move to bottom, bottom left of the current cell and bottom right of the current cells only.If one traversal already gets some points from a cell, In the next traversal no points will be ... Read More

Box Stacking Problem

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

997 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 to maintain.One can place a box on another box if the area of the top surface for the bottom box is larger than the lower area of the top box.Input and OutputInput: A list of boxes is given. Each box is denoted by (length, bredth, height). { (4, 6, 7), ... Read More

Advertisements