## Maximum number of candies that can be bought

Given an array arr[] of size n where arr[i] is the amount of candies of type i. You have unlimited amount of money. The task… Read More »

## Replace array elements by sum of next two consecutive elements

Given an array arr[] of size n, The task is to replace every element of the array by the sum of next two consecutive elements… Read More »

## Spanning Tree With Maximum Degree (Using Kruskal’s Algorithm)

Given an undirected unweighted connected graph consisting of n vertices and m edges. The task is to find any spanning tree of this graph such… Read More »

## Number of subarrays having sum of the form k^m, m >= 0

Given an integer k and an array arr[], the task is to count the number of sub-arrays which have the sum equal to some positive… Read More »

## Count common characters in two strings

Given two strings s1 and s2 consisting of lowercase English alphabets, the task is to count all the pairs of indices (i, j) from the… Read More »

## Given count of digits 1, 2, 3, 4, find the maximum sum possible

Given the count of digits 1, 2, 3, 4. Using these digits you are allowed to only form numbers 234 and 12. The task is… Read More »

## Find the good permutation of first N natural numbers

Given an integer N, the task is to print a good permutation of first N natural numbers. Let’s denote the ith element of the permutation… Read More »

## Find the maximum number of composite summands of a number

Given an integer N(1<=N<=10^9). The task is to represent N as a sum of the maximum possible number of composite summands and print this maximum… Read More »

## Find the numbers of strings that can be formed after processing Q queries

Given a number N(1<=N<=2000)., The task is to find the number strings of size N that can be obtained after using characters from 'a' to… Read More »

## Minimum number of given operation required to convert n to m

Given two integers n and m, in a single operation n can be multiplied by either 2 or 3. The task is to convert n… Read More »

## Minimize the cost to split a number

Given an integer N ≥ 2, you can split the number as a sum of k integers i.e. N = k1 + k2 + …… Read More »

## Find the weight of the minimum spanning tree

Given a connected undirected weighted graph with N nodes and M edges. The task is to perform given queries and find the weight of the… Read More »

## Program to find the kth character after decrypting a string

Given a string str consisting of characters and numbers and an integer k, the task is to decrypt the string and the return the kth… Read More »

## Sum of Fibonacci Numbers in a range

Given a range [l, r], the task is to find the sum fib(l) + fib(l + 1) + fib(l + 2) + ….. + fib(r)… Read More »

## Replace all elements by difference of sums of positive and negative numbers after that element

Given an array of positive and negative elements. The task is to replace every i-th element of the array by the absolute difference of absolute… Read More »