## Sum of (maximum element – minimum element) for all the subsets of an array.

Given an array arr[], the task is to compute the sum of (max{A} – min{A}) for every non-empty subset A of the array arr[]. Examples:… Read More »

- Count common characters in two strings
- Sort an array without changing position of negative numbers
- Nth number whose sum of digit is multiple of 10
- Given two arrays count all pairs whose sum is an odd number
- Find maximum xor of k elements in an array
- Find minimum difference between any two elements | Set 2
- Why Should I Learn Coding?
- Interactive Problems in Competitive Programming
- Check whether two strings contain same characters in same order
- Total number of possible Binary Search Trees using Catalan Number
- Find the minimum number of operations required to make all array elements equal
- Maximize the happiness of the groups on the Trip
- Spanning Tree With Maximum Degree (Using Kruskal's Algorithm)
- Find the number of pair of Ideal nodes in a given tree
- Find the minimum number of elements that should be removed to make an array good
- Sum of digits with even number of 1's in their binary representation
- Find sub-arrays from given two arrays such that they have equal sum
- Count of all possible values of X such that A % X = B
- Equal Sum and XOR of three Numbers
- Lexicographically Smallest Topological Ordering
- Lazy Propagation in Segment Tree | Set 2
- Convert the undirected graph into directed graph such that there is no path of length greater than 1
- Check which player visits more number of Nodes
- Find the Nth Mosaic number
- Replace array elements by sum of next two consecutive elements
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Optimally accommodate 0s and 1s from a Binary String into K buckets
- Check whether a number can be represented as sum of K distinct positive integers
- Find the number of divisors of all numbers in the range [1, n]
- Longest string in an array which matches with prefix of the given string

Given an array arr[], the task is to compute the sum of (max{A} – min{A}) for every non-empty subset A of the array arr[]. Examples:… Read More »

Given an array arr[], the task is to find the number of ways to remove elements from the array so as to maximize the arithmetic… Read More »

Given an integer N, the task is to find the count of all N digit numbers such that num + Rev(num) = 10N – 1… Read More »

Given an array arr[], the task is to find the smallest possible integer (other than 1) which divides every element of the given array. Examples:… Read More »

Given an integer N. The task is to find the count of all the numbers from 1 to N which are not divisible by any… Read More »

Given height and width of N rectangles. The task is to find the size of the largest subset such that no pair of rectangles fit… Read More »

Given an integer N, calculate the number of permutations of A = [1, 2, …, N] which are first decreasing and then increasing. Examples: Input:… Read More »

Given a number N. Find the count of such numbers that can be formed using digits 3 and 4 only and having length at max… Read More »

Given a weighted undirected connected graph with N nodes and M edges. Some of the nodes are marked as good. The task is to find… Read More »

Given an integer N where 4 ≤ N ≤ 100. There are N lines vertically and N lines horizontally. So, There are N2 intersections. The… Read More »

Given an array arr[] of N distinct integers. The task is to find the sum of two array integers a[i] + a[j] which occurs maximum… Read More »

Given an array arr[] of N integers and Q queries. Each query consists of 3 integers L, R and K. You can move from index… Read More »

Given two positive integers N and M., The task is to find the smallest divisor D of N such that gcd(D, M) > 1. If… Read More »

Given an integer N, the task is to find the count of numbers from 1 to N which are divisible by all the numbers from… Read More »

Given an array arr[] of N positive integers and an integer K. It is given that you start at position 0 and you can move… Read More »