## Clustering/Partitioning an array such that sum of square differences is minimum

Given an array of n numbers and a number k. We need to divide the array into k partitions (clusters) of same or different length.… Read More »

Given an array of n numbers and a number k. We need to divide the array into k partitions (clusters) of same or different length.… Read More »

Given an Array, three operations can be performed using any external number x. Add x to an element once Subtract x from an element once… Read More »

Given an array of n distinct positive integers. The task is to find the minimum number of elements to be removed such that no three… Read More »

Given two arrays of integers, compute the pair of values (one value in each array) with the smallest (non-negative) difference. Return the difference. Examples: Input… Read More »

Write a program to input a list of integers in an array and arrange them in a way similar to the to-and-fro movement of a… Read More »

Given an array of n positive distinct integers. The problem is to find the largest sum of contiguous increasing subarray in O(n) time complexity. Examples:… Read More »

Introduction and Implementation : Given an array arr[] of size n, its prefix sum array is another array prefixSum[] of same size such that the… Read More »

Given an array ‘arr1’ of n positive integers. Contents of arr1[] are copied to another array ‘arr2’, but numbers are shuffled and one element is… Read More »

Three arrays of same size are given. Find a triplet such that maximum – minimum in that triplet is minimum of all the triplets. A… Read More »

Given an array, the task is to find average of that array. Average is the sum of array elements divided by the number of elements.… Read More »

Given an array of size n, write a program to check if it is sorted in ascending order or not. Equal values are allowed in… Read More »

Given two positive integer n and n. The task is to find the number of arrays of size n that can be formed such that… Read More »

Given a set of integers, check whether there is a subsequence with odd sum and if yes, then finding the maximum odd sum. If no… Read More »

Given an array of n integers containing only 0 and 1. Find the minimum toggles (switch from 0 to 1 or vice-versa) required such the… Read More »

Given an array of integers arr[] and a number m, count the number of subarrays having XOR of their elements as m. Examples: Input :… Read More »