Dynamic Programming and Greedy

30 problems to practice.

30 Total
26 Easy
4 Medium
0 Hard

Paint Fence

1. You are given a fence with n posts and each post can be painted with one of them k colours 2. Y...

easy

Paint House

1. You are given N houses, each house can be painted with 3 different colours: red, blue or green...

easy

Fibonacci-dp

1. You are given a number n. 2. You are required to print the nth element of fibonnaci sequence....

easy

Climb Stairs

1. You are given a number n, representing the number of stairs in a staircase. 2. You are on the 0t...

easy

Climb Stairs With Variable Jumps

1. You are given a number n, representing the number of stairs in a staircase. 2. You are on the 0t...

easy

Climb Stairs With Minimum Moves

1. You are given a number n, representing the number of stairs in a staircase. 2. You are on the 0t...

easy

Min Cost In Maze Traversal

1. You are given a number n, representing the number of rows. 2. You are given a number m, represen...

easy

Goldmine

1. You are given a number n, representing the number of rows. 2. You are given a number m, represen...

easy

Target Sum Subsets - Dp

1. You are given a number n, representing the count of elements. 2. You are given n numbers. 3. Yo...

medium

Coin Change Combination

1. You are given a number n, representing the count of coins. 2. You are given n numbers, represent...

easy

Coin Change Permutations

1. You are given a number n, representing the count of coins. 2. You are given n numbers, represent...

medium

Zero One Knapsack

1. You are given a number n, representing the count of items. 2. You are given n numbers, represent...

easy

Unbounded Knapsack

1. You are given a number n, representing the count of items. 2. You are given n numbers, represent...

easy

Fractional Knapsack - Official

1. You are given a number n, representing the count of items. 2. You are given n numbers, represent...

easy

Count Binary Strings

1. You are given a number n. 2. You are required to print the number of binary strings of length n...

easy

Arrange Buildings

1. You are given a number n, which represents the length of a road. The road has n plots on it's eac...

easy

Count Encodings

1. You are given a string str of digits. (will never start with a 0) 2. You are required to encode...

easy

Count A+b+c+ Subsequences

1. You are given a string str. 2. You are required to calculate and print the count of subsequences...

easy

Maximum Sum Non Adjacent Elements

1. You are given a number n, representing the count of elements. 2. You are given n numbers, repres...

easy

Paint House - Many Colors

1. You are given a number n and a number k separated by a space, representing the number of houses a...

easy

Tiling With 2 * 1 Tiles

1. You are given a number n representing the length of a floor space which is 2m wide. It's a 2 * n...

easy

Tiling With M * 1 Tiles

1. You are given a number n and a number m separated by line-break representing the length and bread...

easy

Friends Pairing

1. You are given a number n, representing the number of friends. 2. Each friend can stay single or...

easy

Partition Into Subsets

1. You are given a number n, representing the number of elements. 2. You are given a number k, repr...

easy

Buy And Sell Stocks - One Transaction Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

easy

Buy And Sell Stocks - Infinite Transactions Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

easy

Buy And Sell Stocks With Transaction Fee - Infinite Transactions Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

medium

Buy And Sell Stocks With Cooldown - Infinite Transaction Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

medium

Buy And Sell Stocks - Two Transactions Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

easy

Buy And Sell Stocks - K Transactions Allowed

1. You are given a number n, representing the number of days. 2. You are given n numbers, where ith...

easy