## Find the lexicographically smallest string which satisfies the given condition

Given an array, arr[] of N integers, where arr[i] represents the number of distinct characters in the prefix of length (i + 1) of a… Read More »

## Find the sum of digits of a number at even and odd places

Given a number N, the task is to find the sum of digits of a number at even and odd places. Examples: Input: N =… Read More »

## Count the number of currency notes needed

You have an unlimited amount of banknotes worth A and B dollars (A not equals to B). You want to pay a total of S dollars using exactly N notes. The… Read More »

## Divide a number into two parts

Given an integer N containing the digit 4 at least once. The task is to divide the number into two parts x1 and x2 such… Read More »

## Number of times the largest perfect square number can be subtracted from N

Given a number N. At every step, subtract the largest perfect square( ≤ N) from N. Repeat this step while N > 0. The task… Read More »

## Length of the longest substring with no consecutive same letters

Given a string str, the task is to find the length of the longest sub-string which does not have any pair of consecutive same characters.… Read More »

## Minimum number of changes such that elements are first Negative and then Positive

Given an array arr[] of size N. The task is to find the minimum number of changes required to convert the array such that for… Read More »

## Sum of elements in an array whose difference with the mean of another array is less than k

Given two unsorted arrays arr1[] and arr2[]. Find the sum of elements from arr1[] whose difference with the mean of arr2[] is < k. Examples:… Read More »

## Find n positive integers that satisfy the given equations

Given three integers N, X and Y. The task is to find N positive integers that satisfy the given equations. a12 + a22 + ….… Read More »

## Find the minimum number of steps to reach M from N

Given two integers N and M. The task is to find the minimum number of steps to reach M from N by performing given operations.… Read More »

## Find the number of jumps to reach X in the number line from zero

Given an integers X. The task is to find the number of jumps to reach a point X in the number line starting from zero.… Read More »

## 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 »

## Maximum array sum that can be obtained after exactly k changes

Given an array arr[] of n integers and an integer k. The task is to maximize the sum of the array after performing the given… 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 »

## Maximal Disjoint Intervals

Given a set of N intervals, the task is to find the maximal set of mutually disjoint intervals. Two intervals [i, j] & [k, l]… Read More »