## Maximum subarray sum in O(n) using prefix sum

Given an Array of Positive and Negative Integers, find out the Maximum Subarray Sum in that Array. Examples: Input1 : arr = {-2, -3, 4,… Read More »

Given an Array of Positive and Negative Integers, find out the Maximum Subarray Sum in that Array. Examples: Input1 : arr = {-2, -3, 4,… Read More »

Given a array size of n, find the last k digits (1 <= k < 10) of product of array numbers Examples: Input : a[]… Read More »

Given an array of n non-negative integers. Choose three indices i.e. (0 <= index_1 <= index_ 2<= index_3 <= n) from the array to make… Read More »

Given an array of positive integers of length n. Our task is to find minimum number of operations to convert an array so that arr[i]… Read More »

Given a array size of n, we need to find the total number of zeros in the product of array. Examples: Input : a[] =… Read More »

Given an array of size N. Find the number of pairs (i, j) such that XOR = 0, and 1 <= i < j <=… Read More »

Given an array of n integers, find the sum of f(a[i], a[j]) of all pairs (i, j) such that (1 <= i < j <=… Read More »

Given a list of distinct unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs,… Read More »

Insertion Sort is suitable for arrays of small size. It also achieves best-case complexity of O(n) if the arrays are already sorted. We have discussed… Read More »

Given an array of N integers with duplicates allowed. All elements are ranked from 1 to N if they are distinct. If there are say… Read More »

Given an array of size n. It is also given that range of numbers is from smallestNumber to smallestNumber + n where smallestNumber is the… Read More »

Sum of array is a small problem where we have to add each element in the array by traversing through the entire array. But when… Read More »

Given an array, the task is to find if the input array contains a majority element or not. An element is Examples: Input : arr[]… Read More »

Given 3 arrays (A, B, C) which are sorted in ascending order, we are required to merge them together in ascending order and output the… Read More »

Given an Array of Integers and an Integer value k, find out k non-overlapping sub-arrays which have k maximum sums. Examples: Input : arr1[] =… Read More »