## Min Cost Path | DP-6

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 »

- Eggs dropping puzzle (Binomial Coefficient and Binary Search Solution)
- Maximum profit after buying and selling the stocks
- Program to find the Hidden Number
- Reach the numbers by making jumps of two given lengths
- Longest subarray having average greater than or equal to x
- Modular exponentiation (Recursive)
- Find the unit place digit of sum of N factorials
- Largest palindromic number in an array
- Make all numbers of an array equal
- Puzzle | Cut Blue Painted Cube
- Check if a number is perfect square without finding square root
- Check if a number can be expressed as a^b | Set 2
- Puzzle | Selling Chocolates
- A Sum Array Puzzle
- Sum of the first N Prime numbers
- Final cell position in the matrix
- Check if it is possible to reach a number by making jumps of two given length
- Probability that two persons will meet
- Program to find minimum number of lectures to attend to maintain 75%
- Sum of minimum elements of all subarrays
- Generate all rotations of a number
- Number of array elements derivable from D after performing certain operations
- Sum of the multiples of two numbers below N
- Number of quadrilaterals possible from the given points
- Check if a number is a Mystery Number
- Count number of triplets with product equal to given number with duplicates allowed
- Minimum number of sets with numbers less than Y
- Sum of all Primes in a given range using Sieve of Eratosthenes
- Minimum operations required to make all the array elements equal
- Find elements of array using XOR of consecutive elements

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: {} Input : n=2 Output: {}{} {{}} Algorithm:… 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 »

Algorithm: This method can be derived from (but predates) Newton–Raphson method. 1 Start with an arbitrary positive start value x (the closer to the root,… Read More »

There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained after merging… Read More »

Asked by Anshya. Below are the different ways to add base 14 numbers. Method 1 Thanks to Raj for suggesting this method. 1. Convert both… Read More »

Lucky numbers are subset of integers. Rather than going into much theory, let us see the process of arriving at lucky numbers, Take the set… Read More »