Given an array of positive integers we have to find number of pair of elements whose difference is smaller than average difference. Average difference is defined as (max(A)-min(A))/(n-1), where A is the array and Read more →
C++ Programs
155 postsGiven a matrix mat[][] of size M x N integers where M is the number of rows and N is the number of columns and a number K. The task is to Read more →
Given heights of n rectangles and two positive integers x and y. You start moving from the rectangle at 0th index. In one move you can perform one of the following operations: Read more →
Given a number num (0 < num < 108), the task is to sort the digits of the number such that even indices are in ascending order and odd indices in descending Read more →
Given an array A of size N. A boolean array B consisting of N-1 elements indicates that if B[i] is 1 then A[i] can be swapped with A[i+1]. Find if A can Read more →
Given an array of N integers, where each value represents the volume of the cloud. The task is to choose the two highest volume clouds from an array and smash them together. Read more →
Given a string s, the task is to print all permutations of a string that are in ascending order, i.e., their characters are in ascending order. Examples: Input: Cplusplus Output: Cllppssuu Out Read more →
Given two array A[] and B[] of length N, the task is the find the minimum cost to make array A[] a permutation of array B[], where the cost of incrementing or Read more →
Given an array of n integers, you need to find minimum number of below operation such that arrays becomes sorted in non-decreasing order. In a single operation you can rotate the given Read more →
Given an array of integers, A[] of size n with elements in range 1 to n may not consist of all the numbers from 1 to n. There are two players P1 Read more →