# Arrays

### Minimum replacements required to make sum of all K-length subarrays equal

Given an array arr[] consisting of N positive integers and an integer K, the task is to make the sum…

### Rearrange an array to maximize sum of Bitwise AND of same-indexed elements with another array

#include using namespace std;int maximizeAnd(int i, int mask,                int* A, int* B, int N,                vector& dp){        if (i == N)        return 0;            if (dp[i][mask] !=…

### Prefix Factorials of a Prefix Sum Array

Given an array arr[] consisting of N positive integers, the task is to find the prefix factorials of a prefix…

### Count inversions in a permutation of first N natural numbers

Count inversions in a permutation of first N natural numbersGiven an array, arr[] of size N denoting a permutation of…

### Minimum number of jumps required to sort numbers placed on a number line

#include using namespace std;void minJumps(int w[], int l[], int n){        if (n == 1) {        cout prevElementPos)            continue;                                while (currElementPos

### Maximum frequency of any array element possible by at most K increments

Given an array arr[] of size N and an integer K, the task is to find the maximum possible frequency…

### Minimize sum of product of same-indexed elements of two arrays by reversing a subarray of one of the two arrays

import java.io.*;import java.util.*;  public class Main {                  static void minimumProdArray(long a[],                                 long b[], int l)    {        long total = 0;                  for (int i = 0; i…

### Print greater elements present on the left side of each array element

Print greater elements present on the left side of each array elementGiven an array arr[] consisting of N distinct integers,…