## Coin Change | DP-7

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More »

- Must do Math for Competitive Programming
- Product of all Subarrays of an Array
- Perfect Sum Problem
- Pi(π) in C++ with Examples
- Program to calculate Electricity Bill
- Count of subsets with sum equal to X using Recursion
- Modulo Operator (%) in C/C++ with Examples
- Logarithm tricks for Competitive Programming
- Check whether a number can be represented as difference of two squares
- Find the K closest points to origin using Priority Queue
- Maximum number of unique values in the array after performing given operations
- Count of subarrays having exactly K perfect square numbers
- Sum of GCD of all possible sequences
- Minimize the maximum difference of adjacent elements after at most K insertions
- Minimum number of operations to convert array A to array B by adding an integer into a subarray
- Puzzle | Dividing a Square into N smaller squares
- Expected Number of Trials to get N Consecutive Heads
- Count of subarrays which start and end with the same element
- Find the numbers from 1 to N that contains exactly k non-zero digits
- Find the K-th Permutation Sequence of first N natural numbers
- Maximum profit by buying and selling a share at most K times | Greedy Approach
- 0/1 Knapsack Problem to print all possible solutions
- Finding Median of unsorted Array in linear time using C++ STL
- Longest Mountain Subarray
- Find the Mth element of the Array after K left rotations
- Maximum GCD of all subarrays of length at least 2
- Average of Cubes of first N natural numbers
- Check if a given number is a Perfect square using Binary Search
- Digital Root of a given large integer using Recursion
- Last digit of sum of numbers in the given range in the Fibonacci series

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More »

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function… Read More »

Difficulty Level: Rookie Given a stream of numbers, print average (or mean) of the stream at every point. For example, let us consider the stream… Read More »

Given two integers k and n, write a function that prints all the sequences of length k composed of numbers 1,2..n. You need to print… Read More »

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »

Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no… Read More »

Given a positive number n, write a function isMultipleof5(int n) that returns true if n is multiple of 5, otherwise false. You are not allowed… Read More »

Backtracking is an algorithmic paradigm that tries different solutions until finds a solution that “works”. Problems which are typically solved using backtracking technique have following… Read More »

The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..… Read More »

Write a function to generate all possible n pairs of balanced parentheses. Examples: Input: n=1 Output: {} Explantaion: This the only sequence of balanced parenthesis… Read More »

Method 1 (Using Nested Loops) We can calculate power by using repeated addition. For example to calculate 5^6. 1) First 5 times add 5, we… Read More »

Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all… Read More »

You can win three kinds of basketball points, 1 point, 2 points, and 3 points. Given a total score n, print out all the combination… Read More »

Given an integer n, find whether it is a power of 4 or not. Example : Input : 16 Output : 16 is a power… Read More »

By making use of recursion, we can multiply two integers with the given constraints. To multiply x and y, recursively add x y times. C++… Read More »