Longest subarray having maximum sum
Given an array arr[] containing n integers. The problem is to find the length of the subarray having maximum sum. If there exists two or more subarrays with maximum sum then print the length of the longest subarray.Examples:...
read more
Count quadruplets with sum K from given array
Given an array arr[] of size N and an integer S, the task is to find the count of quadruplets present in the given array having sum S....
read more
Partition array into minimum number of equal length subsets consisting of a single distinct value
Given an array arr[] of size N, the task is to print the minimum count of equal length subsets the array can be partitioned into such that each subset contains only a single distinct element...
read more
Print all strings from given array that can be typed using keys from a single row of a QWERTY keyboard
Given an array of strings arr[], consisting of strings made up of lowercase and uppercase letters, the task is to print all the strings from the given array that can be typed using keys from a single row of a QWERTY keyboard....
read more
Largest rectangular sub-matrix having sum divisible by k
Given a n x n matrix of integers. The problem is to find the largest area rectangular sub-matrix having sum divisible by the given value k....
read more
Number of substrings having an equal number of lowercase and uppercase letters
Given string S consists of lowercase and uppercase letters, the task is to find the number of substrings having an equal number of lowercase and uppercase letters....
read more
Count words that appear exactly two times in an array of words
Given an array of n words. Some words are repeated twice, we need to count such words....
read more
Queries to check if a number lies in N ranges of L-R
Given N ranges and Q queries consisting of numbers. Every range consists of L and R. The task is to check if the given number lies in any of the given ranges or not for every query.Note: There is no overlapping range.Examples:...
read more
Total length of string from given Array of strings composed using given characters
Given a list of characters and an array of strings, find the total length of all strings in the array of strings that can be composed using the given characters.Examples:...
read more
Remove elements from the array which appear more than k times
Given an array of integers, remove all the occurrences of those elements which appear strictly more than k times in the array.Examples:...
read more
Minimum array elements required to be subtracted from either end to reduce K to 0
Given an array arr[] consisting of N integers and an integer K, the task is to reduce K to 0 by removing an array element from either end of the array and subtracting it from K. If it is impossible to reduce K to 0, then print “-1”. Otherwise, print the minimum number of such operations required....
read more
Size of smallest subarray to be removed to make count of array elements greater and smaller than K equal
Given an integer K and an array arr[] consisting of N integers, the task is to find the length of the subarray of smallest possible length to be removed such that the count of array elements smaller than and greater than K in the remaining array are equal....
read more