## Minimize the sum of digits of A and B such that A + B = N

Given an integer N, the task is to find two positive integers A and B such that A + B = N and the sum… Read More »

## Multiplication on Array : Range update query in O(1)

Consider an array A[] of integers and the following two types of queries. update(l, r, x): multiply x to all values from A[l] to A[r]… Read More »

## Optimal Strategy for a Game | Special Gold Coin

Given a row of silver coins among which a special gold coin is present. Two players play the game, and with each move, a player… Read More »

## Find the coordinates of a triangle whose Area = (S / 2)

Given an integer S, the task is to find the coordinates of a triangle whose area is (S / 2). Examples: Input: S = 4… Read More »

## Rearrange array elements such that Bitwise AND of first N – 1 elements is equal to last element

Given an array arr[] of N positive integers, the task is to find an arrangement such that Bitwise AND of the first N – 1… Read More »

## Maximum prime moves to convert X to Y

Given two integers X and Y, the task is to convert X to Y using the following operations: Add any prime number to X. Subtract… Read More »

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

## Count non-adjacent subsets from numbers arranged in Circular fashion

Given that N people are sitting in a circular queue numbered from 1 to N, the task is to count the number of ways to… Read More »

## Minimize sum by dividing all elements of a subarray by K

Given an array arr[] of N integers and a positive integer K, the task is to minimize the sum of the array elements after performing… Read More »

## Find Range Value of the Expression

Given two integers L and R, the task is to calculate the value of the expression:     Examples: Input: L = 6, R =… Read More »

## Minimum numbers with one’s place as 9 to be added to get N

Given an integer N, the task is to find the minimum count of numbers which needs to be added to get N. (All such numbers… Read More »

## Minimum increment or decrement operations required to make the array sorted

Given an array arr[] of N integers, the task is to sort the array in non-decreasing order by performing the minimum number of operations. In… Read More »

## Sum of numbers in a range [L, R] whose count of divisors is prime

Given Q queries where each query consists of an integer range [L, R], the task is to find the sum of the integers from the… Read More »

## Minimize the cost of partitioning an array into K groups

Given an array arr[] and an integer K, the task is to partition the array into K non-empty groups where each group is a subarray… Read More »

## Find next greater element with no consecutive 1 in it’s binary representation

Given Q queries where each query consists of an integer N and the task is to find the smallest integer greater than N such that… Read More »