Generate an N-length array having maximum element minimized and sum of array elements divisible by KGiven two positive integers N…

# Arrays

### Maximum ranges that can be uniquely represented by any integer from the range

Given an array arr[] consisting of N ranges of the form {L, R}, the task is to find the maximize…

### Find the array element having equal count of Prime Numbers on its left and right

#include using namespace std; int findIndex(int arr[], int N){ int maxValue = INT_MIN; for (int i = 0; i < N; i++) { maxValue…

### Minimum removal of elements from end of an array required to obtain sum K

#include using namespace std; int minSizeArr(int A[], int N, int K){ int leftTaken = N, rightTaken = N; int leftSum = 0, rightSum…

### Numbers of pairs from an array whose average is also present in the array

import java.io.*;import java.util.*; class GFG { static int getCountPairs(int arr[], int N, int S) { HashMap mp = new HashMap(); for (int i = 0; i <…

### Minimum operations required to make all elements in an array of first N odd numbers equal

Minimum operations required to make all elements in an array of first N odd numbers equalGiven an array consisting of…

### Minimum difference possible between two given numbers by rearranging their digits in the same order

#include using namespace std; int minDifference(int X, int Y){ int minDiff = INT_MAX; string x = to_string(X); string y = to_string(Y); int n = x.size(); int…

### Maximum subarray sum possible after removing at most one subarray

import java.io.*;import java.util.*; class GFG { public static void maximumSum( int arr[], int n) { long[] preSum = new long[n]; long sum = 0; long maxSum =…

### Check whether an array can be made strictly increasing by removing at most one element

Check whether an array can be made strictly increasing by removing at most one elementGiven an array arr[] consisting of…

### Segregate Prime and Non-Prime Numbers in an array

import java.io.*;import java.lang.*;import java.util.*;public class GFG { static boolean isPrime(int n) { if (n