## 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 »

- Largest subarray having sum greater than k
- Kth Smallest sum of continuous subarrays of positive numbers
- Longest substring with count of 1s more than 0s
- Find the sums for which an array can be divided into sub-arrays of equal sum
- Count the number of vowels occurring in all the substrings of given string
- Sum of all Primes in a given range using Sieve of Eratosthenes
- Subarray whose absolute sum is closest to K
- Replace every element of the array by sum of all other elements
- Maximum sum subarray such that start and end values are same
- Product of all primes in the range from L to R
- Index with Minimum sum of prefix and suffix sums in an Array
- Split array to three subarrays such that sum of first and third subarray is equal and maximum
- Sum of first N natural numbers by taking powers of 2 as negative number
- Longest subarray having average greater than or equal to x | Set-2
- Find the value of max(f(x)) - min(f(x)) for a given F(x)
- Partition an array such into maximum increasing segments
- Sum of all prime divisors of all the numbers in range L-R
- Check if every index i has an index j such that sum of elements in both directions are equal
- Count number of indices such that s[i] = s[i+1] : Range queries
- Minimum elements to change so that for an index i all elements on the left are -ve and all elements on the right are +ve
- Check if a large number can be divided into two or more segments of equal sum
- Sudo Placement[1.5] | Partition
- Maximum occurred integer in n ranges | Set-2
- Check whether two strings can be made equal by increasing prefixes
- First element greater than or equal to X in prefix sum of N numbers using Binary Lifting
- Check if a line at 45 degree can divide the plane into two equal weight parts

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 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 a binary string containing only 0’s and 1’s. Write a program to find number of sub-strings of this string whose decimal representation is odd.… Read More »

Given a string of length n and a subsequence of length 3. Find the total number of occurrences of the subsequence in this string. Examples… Read More »

Given N elements (both positive and negative). Find the maximum sum, provided that the first operation is to take some prefix of the sequence and… Read More »

Given a binary string, find the longest subsequence of the form (0)*(1)*(0)* in it. Basically we need to divide the string into 3 non overlapping… Read More »

Given a range [L, R], we need to find the count of total numbers of prime numbers in the the range [L, R] where 0… Read More »

Given an array of n integers. You are given q queries. Write a program to print floor value of mean in range l to r… Read More »

Given an array of size ‘n’ and a given set of commands of size ‘m’. Every command consist of four integers q, l, r, k.… Read More »

Given a binary string of length N and an integer K, we need to find out how many substrings of this string are exist which… Read More »

Given, an array of size n. Find an element which divides the array in two sub-arrays with equal sum. Examples: Input : 1 4 2… Read More »

Given an array containing n numbers. The problem is to split the array into two subarrays such that the absolute difference of the xor values… Read More »

Given an array and two integers say, x and y, find the number of subarrays in which the number of occurrences of x is equal… Read More »

Given an array containing n integers and a value d. m queries are given. Each query has two values start and end. For each query,… Read More »

Given an array of both positive and negative numbers, the task is to find out the subarray whose sum is closest to 0. There can… Read More »