## Ways to fill N positions using M colors such that there are exactly K pairs of adjacent different colors

Given three integers N, M and K. The task is to find the number of ways to fill N positions using M colors such that… Read More »

- Optimal Strategy for a Game | Set 2
- Samsung Interview Experience through Co-cubes (2019)
- Maximum sum such that no two elements are adjacent | Set 2
- Longest subsequence such that adjacent elements have at least one common digit
- Bellman Ford Algorithm (Simple Implementation)
- Double Knapsack | Dynamic Programming
- Coin Change | BFS Approach
- Minimum time required to rot all oranges | Dynamic Programming
- Partition an array of non-negative integers into two subsets such that average of both the subsets is equal
- Longest path in a directed Acyclic graph | Dynamic Programming
- Minimum number of cubes whose sum equals to given number N
- Maximum sum combination from two arrays
- Count of integers of length N and value less than K such that they contain digits only from the given set
- LCA in a tree using Binary Lifting Technique
- Minimum cost to reach end of array array when a maximum jump of K index is allowed
- Maximize the happiness of the groups on the Trip
- Count number of ways to reach a given score in a Matrix
- Maximum Sum Subsequence of length k
- Maximum sum path in a matrix from top to bottom and back
- Number of subsets with zero sum
- Distinct palindromic sub-strings of the given string using Dynamic Programming
- Flip minimum signs of array elements to get minimum sum of positive elements possible
- Find the number of binary strings of length N with at least 3 consecutive 1s
- Maximum subarray sum by flipping signs of at most K array elements
- Greedy approach vs Dynamic programming
- Iterative approach to print all permutations of an Array
- Divide the array in K segments such that the sum of minimums is maximized
- Count pairs of non-overlapping palindromic sub-strings of the given string
- Minimum steps to delete a string by deleting substring comprising of same characters
- Number of ways to choose elements from the array such that their average is K

Given three integers N, M and K. The task is to find the number of ways to fill N positions using M colors such that… Read More »

Given an N X M matrix, where ai, j = 1 denotes the cell is not empty, ai, j = 0 denotes the cell is… Read More »

Given an array arr[] of strings of same length, the task is to count the number of columns to be deleted so that all the… Read More »

Given two positive integers n and k, the task is to count the number of special permutations. A special permutation P is defined as a… Read More »

Given and . The task is to find the number of binary strings of length n out of 2n such that they satisfy f(bit string)… Read More »

Given a K-ary tree, where each node is having K children and each edge has some weight. All the edges i.e. K, that goes from… Read More »

Given a string str comprising of characters (, ), {, }, [, ] and ?. The task is to find the total number of balanced… Read More »

Given two numbers x, y which denotes the number of set bits. Also given is a number C. The task is to print the number… Read More »

Given a N X N matrix consisting of characters. Also given are Q queries, where each query contains a co-ordinate (X, Y). For every query,… Read More »

Given two integers N and K, the task is to find the number of ways to place K bishops on an N × N chessboard… Read More »

Given a number, N. find the sum of first N odd Fibonacci numbers. Note: The answer can be very large so print the answer modulo… Read More »

Given a string ‘S’ consisting of open and closed brackets, the task is find the number of ways in which each character of ‘S’ can… Read More »

Given integers N, P and Q where N denotes the destination position. The task is to move from position 0 to position N with minimum… Read More »

Given n cities: x1, x2, …… xn: each associated with T[i] (treasure) and C[i] (color). You can choose to visit a city or skip it.… Read More »

Recursion is a programming technique where a function calls itself repeatedly till a termination condition is met. Some of the examples where recursion is used… Read More »