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 →
Data Structures
5 postsGiven 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 →
Given a string find the character which occurs a minimum number of times. Note: If multiple such characters exist output anyone. Example: Input: S = abbccdd Output: a As frequency of every 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 →
Given a string A, compute the minimum number of characters you need to delete to make resulting string a palindrome. Examples: Input : baca Output : 1 Input : cplusplus Output : Read more →
Given a binary array consisting of only 0s and 1s, find the maximum distance between two elements with value 0 in a subarray {l,r}. Examples: Input : arr = {1,0,0,1}, l=0, r=3 Read more →