Given an array arr[] of N points. The task is to sort these points according to it’s distance from the origin. Examples: Input: arr[] = { {5,0}, {4,0}, {3,0}, {2,0}, {1,0} } Read more →
Arrays
106 postsGiven an array arr, the task is to find the sum of the elements which have composite frequencies in the array. Examples: Input: arr[] = {5, 4, 6, 5, 4, 6} Output: Read more →
Given an array arr, the task is to find the product of the elements which have composite frequencies in the array. Examples: Input: arr[] = {4, 6, 5, 4, 6} Output: 5 Read more →
One combination of made up of N different things. You are given an array of length N which indicate the amount of N different things which one combination contain. You are given Read more →
Given an array arr[] of size N, find the length of its longest subarray such that the sum of its elements not divisible by K, or determine that such subarray does not Read more →
Given two arrays of element between 0 to N- 1 of length N. Find the lexicographically smallest array c such that for any index i c[i] = ( a[i] + b[i])%N. To Read more →
Given 2 sorted arrays A and B of size N each. Print the sum of the middle elements of the array obtained after merging the given arrays. Examples: Input: arr1: 1 2 Read more →
There is an array arr[] of length N. Your task is to find the sum of the minimum elements of each possible sub-array of the array. Examples: Input : arr[] = {2, Read more →
Given a sorted rotated array, the task is to find index of minimum element of the array. Following solution assumes that all elements are distinct. Examples: Input : arr[] = {5, 6, Read more →
Write an efficient C program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Examples: Input : {-2, -3, 4, -1, -2, 1, Read more →