Topic:Dynamic Programming

Maximize the number of cut segments of length x, y and z

We are given a rod of length L, our task is to cut the rod into segments of x, y & z such that the total number of segments formed are maximized. Note - The cut segments should be...

Wildcard Pattern Matching using Dynamic Programming

Wildcard Pattern Matching - Given a text of length n and a wildcard pattern of length m, we are supposed to find whether the wildcard pattern matches the actual string. The pattern will consist of 2 wildcard character '?' and...

DP – Coin Change: Find number of ways of representing n cents

Given an infinite supply of 25 cents, 10 cents, 5 cents, and 1 cent. Find the number of ways of representing n cents. (The order doesn’t matter). This is a coin change problem and will require the implementation of...

Sieve of Eratosthenes

Sieve of Eratosthenes is an algorithm to find all prime numbers up to a given range. This concept is very important when it comes to competitive programming because it is the most efficient way to find all primes smaller...

Print all possible combinations of balanced valid parenthesis

We have to write an algorithm to print all possible combinations of the balanced valid parenthesis for n pairs of parenthesis. A valid parenthesis is one that is properly opened and closed. Example->  n...

Find if a path is possible for reaching bottom right from the top left in a nxm grid

A robot sitting on the upper left corner(0,0) of a grid with r rows and c columns. The robot can only move in two directions: right or down, but certain cells are "off-limits" such that the robot cannot step on...

Count number of ways to reach the nth stair by climbing 1, 2 or 3 steps

A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to Count number of ways to reach the nth stair by climbing 1,...

Subscribe to our weekly newsletter

Join our community of 1000+ developers and stay updated with the fast moving world of computer science

We promsie, we won't spam
Even we hate spam as much as you hate them