# Sorting

### Count of index subsets such that maximum of values over these indices in A is at least total sum over B

#include using namespace std;  int countValidSubsets(int A[], int B[], int N){    int ans = 0;      vector AB(N);              int mx = INT_MIN;                  for (int i =…

### Find all possible unique indices after reducing the array based on given conditions

Given an array arr of N integers, and an array of keys, such that key for each element in arr…

### Split given Array in minimum number of subarrays such that rearranging the order of subarrays sorts the array

Given an array arr[] consisting of N integers, the task is to find the minimum number of splitting of array…

### Split array into minimum number of subsets having difference between maximum and minimum element at most K

Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum number…

### Sort given sentence on the basis of integer present in every string

Given a jumbled sentence as a list of strings, the task is to print the sorted sentence of strings on…

### Sort N triplets

Given a array arr[ ] of N triplets, the task is to order the triplets in descending order. Triplet X…

### Modify array to a permutation of consecutive numbers of longest length by at most K insertions

Given an array arr[] of length N and an integer K, the task is to find the maximize the length…

### Maximum sum of K elements selected from a Matrix

#include using namespace std;int maximumSum(vector& prefixSum,               vector& dp,               int K, int N, int rem, int id){        int ans = INT_MIN;        if (rem == 0)        return…