Javascript Program for Count Primes in Ranges
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of queries for different ranges.Examples:...
read more
Javascript Program for Equilibrium index of an array
Write a function int equilibrium(int[] arr, int n); that given a sequence arr[] of size n, returns an equilibrium index (if any) or -1 if no equilibrium indexes exist. The equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in an array A:...
read more
Php Program to Count Primes in Ranges
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 <= L <= R < 10000. Consider that there are a large number of queries for different ranges.Examples:...
read more
Javascript Program to Find if there is a subarray with 0 sum
Given an array of positive and negative numbers, find if there is a subarray (of size at-least one) with 0 sum....
read more
Javascript Program for Mean of range in array
Given an array of n integers. You are given q queries. Write a program to print the floor value of mean in range l to r for each query in a new line....
read more
Php Program for Mean of range in array
Given an array of n integers. You are given q queries. Write a program to print the floor value of mean in range l to r for each query in a new line....
read more
Javascript Program for Range sum queries for anticlockwise rotations of Array by K indices
Given an array arr consisting of N elements and Q queries of the following two types:...
read more
Php Program for Maximum equilibrium sum in an array
Given an array arr[]. Find the maximum value of prefix sum which is also suffix sum for index i in arr[]....
read more
Javascript Program for Maximum equilibrium sum in an array
Given an array arr[]. Find the maximum value of prefix sum which is also suffix sum for index i in arr[]....
read more
Minimum absolute difference of XOR values of two subarrays
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 of the two subarrays is minimum....
read more
Count of submatrix with sum X in a given Matrix
Given a matrix of size N x M and an integer X, the task is to find the number of sub-squares in the matrix with sum of elements equal to X.Examples:...
read more
Queries to count characters having odd frequency in a range [L, R]
Given a string S of length N, consisting of lower case alphabets, and queries Q[][] of the form [L, R], the task is to count the number of characters appearing an odd number of times in the range [L, R]....
read more