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:...
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:...
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:...
Given an array of positive and negative numbers, find if there is a subarray (of size at-least one) with 0 sum....
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....
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....
Given an array arr consisting of N elements and Q queries of the following two types:...
Given an array arr[]. Find the maximum value of prefix sum which is also suffix sum for index i in arr[]....
Given an array arr[]. Find the maximum value of prefix sum which is also suffix sum for index i in arr[]....
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....
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:...
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]....