## Sum of Digits of the Good Strings

A string is called good if it is made with only digits 0 to 9 and adjacent elements are different. The task is to find… Read More »

## Minimal product subsequence where adjacent elements are separated by a maximum distance of K

Given an array arr[] and an integer K, the task is to find out the minimum product of a subsequence where adjacent elements of the… Read More »

## Paths with maximum number of ‘a’ from (1, 1) to (X, Y) vertically or horizontally

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 »

## Sum of elements of all partitions of number such that no element is less than K

Given an integer N, the task is to find an aggregate sum of all integer partitions of this number such that each partition does not… Read More »

## Water Jug Problem using Memoization

Given two jugs with the maximum capacity of m and n liters respectively. The jugs don’t have markings on them which can help us to… Read More »

## Number of paths from source to destination in a directed acyclic graph

Given a Directed Acyclic Graph with n vertices and m edges. The task is to find the number of different paths that exist from a… Read More »

## Tetranacci Numbers

The tetranacci numbers are a generalization of the Fibonacci numbers defined by the recurrence relation T(n) = T(n-1) + T(n-2) + T(n-3) + T(n-4) with… Read More »

## Weird Number

In number theory, a weird number is a natural number that is abundant but not semiperfect. In other words, the sum of the proper divisors… Read More »

## Number of ways to reach Nth floor by taking at-most K leaps

Given N number of stairs. Also given the number of steps that one can cover at most in one leap (K). The task is to… Read More »

## Number of ways to represent a number as sum of k fibonacci numbers

Given two numbers N and K. Find the number of ways to represent N as the sum of K Fibonacci numbers. Examples: Input : n… Read More »

## Minimum number of single digit primes required whose sum is equal to N

Find the minimum number of single-digit prime numbers required whose sum will be equal to N. Examples: Input: 11 Output: 3 Explanation: 5 + 3… Read More »

## Minimum cost to reach the top of the floor by climbing stairs

filter_none edit close play_arrow link brightness_4 code //Write Java code here chevron_right filter_none public static int minCostClimbingStairs(int[] cost) { //The idea is to start from… Read More »

## Find all distinct subset (or subsequence) sums of an array | Set-2

Given an array of N positive integers write an efficient function to find the sum of all those integers which can be expressed as the… Read More »

## Maximum sub-matrix area having count of 1’s one more than count of 0’s

Given a N x N binary matrix. The problem is finding the maximum area sub-matrix having a count of 1’s one more than count of… Read More »