Featured Articles
Given a number n, count number of integers smaller than or equal to n that have odd number of set bits.Examples:   Input : 5 Output… Read More
Given a matrix (or 2D array) a[][] of integers, find prefix sum matrix for it. Let prefix sum matrix be psa[][]. The value of psa[i][j]… Read More
Given a rectangular matrix M[0…n-1][0…m-1], and queries are asked to find the sum / minimum / maximum on some sub-rectangles M[a…b][e…f], as well as queries… Read More
A Multistage graph is a directed graph in which the nodes can be divided into a set of stages such that all edges are from… Read More
You have given an array which contain 1 to n element, your task is to sort this array in an efficient way and without replace… Read More
A k-rough or k-jagged number is a number whose smallest prime factor is greater than or equal to the number ‘k’. Given numbers ‘n’ and… Read More
AA trees are the variation of the red-black trees, a form of binary search tree. AA trees use the concept of levels to aid in… Read More
In mathematics, Bertrand’s Postulate states that there is a prime number in the range to where n is a natural number and n >= 4. It has… Read More
An array is given of n length, and we need to calculate the next greater element for each element in the given array. If the… Read More
Given a List (LinkedListor ArrayList) of strings in Java, convert it into an array of strings. Method 1 (Simple using get()) We can use below… Read More
Given an array arr[] and a number k. The task is to delete k elements which are smaller than next element (i.e., we delete arr[i]… Read More
Sum Rule – If a task can be done in one of n1 ways or one of n2 ways, where none of the set of… Read More
Assign value by a pair of {} to a container // Lots of programmers write code  // like this one: pair<int, int> p = make_pair(3,… Read More
Given a queue with random elements, we need to sort it. We are not allowed to use extra space. The operations allowed on queue are… Read More
Given an array, a positive integer, sort the array in ascending order such that the element at index K in the unsorted array stays unmoved… Read More