Given an array arr[], find the maximum j – i such that arr[j] > arr[i]
Given an array arr[], find the maximum j – i such that arr[j] > arr[i].Examples : Input: {34, 8, 10, 3, 2, 80, 30, 33,… Read More »
Given an array arr[], find the maximum j – i such that arr[j] > arr[i].Examples : Input: {34, 8, 10, 3, 2, 80, 30, 33,… Read More »
Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. Expected time complexity is O(Logn)… Read More »
Given a sorted array of n distinct integers where each integer is in the range from 0 to m-1 and m > n. Find the… Read More »
Given an unsorted array of numbers, write a function that returns true if array consists of consecutive numbers. Examples: a) If array is {5, 2,… Read More »
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element… Read More »
Both Arrays and Linked List can be used to store linear data of similar types, but they both have some advantages and disadvantages over each… Read More »
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… Read More »
Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these… Read More »
Unlike C++, arrays are first class objects in Java. For example, in the following program, size of array is accessed using length which is a… Read More »
Given an unsorted array arr[0..n-1] of size n, find the minimum length subarray arr[s..e] such that sorting this subarray makes the whole array sorted. Examples:… Read More »
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put… Read More »
You are given an array of n+2 elements. All elements of the array are in range 1 to n. And all elements occur once except… Read More »
Given an array A[], write a function that segregates even and odd numbers. The functions should put all even numbers first, and then odd numbers. Example: … Read More »
Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all… Read More »
Given a sorted array and a value x, the ceiling of x is the smallest element in array greater than or equal to x, and… Read More »