# Arrays

### Minimize cost to modify the Array such that even indices have even elements and vice versa

Given an array arr[] of size N and two integers X and Y, the task is to find the minimum…

### Maximize sum of ratios of N given fractions by incrementing numerator and denominators K times by 1

#include using namespace std;  double maxAverageRatio(    vector& arr, int K){        int N = arr.size();          priority_queue q;          for (int i = 0; i < N; i++)…

### Count of non decreasing Arrays with ith element in range [A[i], B[i]]

#include using namespace std;  int totalValidArrays(int a[], int b[],                     int N){        int dp[N + 1][b[N – 1] + 1];          int pref[N + 1][b[N –…

### Check if two array of string are equal by performing swapping operations

Given two arrays arr[] and brr[] of the same size containing strings of equal lengths. In one operation any two…

### Maximum length of string formed by concatenation having even frequency of each character

import java.io.*;import java.util.*;  public class index {    static int max = 0;    static String ans1 = “”;          static void calculate(String ans)    {          int dp[] = new…

### Maximum cost of a value over the range [1, N] such that values lies in at most K given ranges

#include using namespace std;  void maxTotalCost(vector& arr,                  int M, int N, int K){        int totMaxSum = 0;      for (int i = 1; i

### Find permutation of numbers upto N with a specific sum in a specific range

#include using namespace std;  bool possible(int x, int S, int N){              int minSum = (x * (x + 1)) / 2;              int maxSum…

### Minimum divide by 2 operations required to make GCD odd for given Array

Given an array arr[] of N positive integers, the task is to find the minimum number of operations required to…