Number of Digit One

Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example 1: Input:...

Daily Temperatures

Given a list of daily temperatures temperatures, return a list such that, for each day in the input, tells you how many days you would...

Staircase Problem-2

Q- A person standing at the ground and wants to reach the top of the stair , there are total N stairs. The person can climb either 1 step...

Staircase Problem-1

A person standing at the ground and wants to reach the top of the stair , there are total N stairs. The person can climb either 1 step or...

Arrays I

Array : It is a Data Structure that is used to store multiple elements of the same Datatype at continuous locations. Declaration in C++ :...

Time Complexity

Time complexity is the time taken by an algorithm to execute as a function of input size. Time complexity is generally estimated by...

Binary Search

Binary search is a fast search algorithm with a run-time complexity of Ο(log n). This search algorithm works on the principle of divide...

Segment Tree

The segment tree is a highly versatile data structure, based upon the divide-and-conquer paradigm, It allows answering range queries over...

Rod Cutting

Question- You are given a rod of length N meter and an array of prices that contains prices for all sizes of rods which are smaller...

Maximal Square

Problem description: Given an m * n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its...

Coin Change

This problem is a variation of unbounded knapsack. Question- Given a array of coins [0..n-1] and a total amount of money $N. Count...

Matrix Sum of Block

Ques: Given a m * n matrix mat and an integer K, return a matrix answer where each answer[i][j] is the sum of all elements mat[r][c] for...

Triangle

Problem description: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the...

Unbounded Knapsack

knapsack means bag. There are three types of Knapsack- 1. 0/1 Knapsack- This comes under inclusion-exclusion principle, we can either...

Largest Plus Sign

Problem description: In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which...

COUNT SUBSET WITH GIVEN SUM

This problem comes under Inclusion - Exclusion category of Dynamic Programing. A small introduction on DP- DP = Recursion + Memoization...

1
2