Skip to content
Featured Articles
As the placement season is back so are we to help you ace the interview. We have selected some most commonly asked and must do… Read More
Given a list of items, sort them in increasing order. Examples: Input : ip[] = {10, 5, 30, 40, 2, 4, 9} Output : op[]… Read More
Python is one of the most preferred languages out there. Its brevity and high readability makes it so popular among all programmers. So here are… Read More
Given two numbers, n >= 0 and 0 <= k <= n, count the number of derangements with k fixed points.Examples:   Input : n =… Read More
Consider the following C/C++ programs and try to guess the output? // Program 1 (Divide by 0) int main() {     int x = 25, y… Read More
A step array is an array of integers where each element has a difference of at most k with its neighbor. Given a key x,… Read More
HeapSort is a comparison based sorting technique where we first build Max Heap and then swaps the root element with last element (size times) and… Read More
Prerequisite: Basic Dynamic Programming, Bitmasks Consider the following problem where we will use Sum over subset Dynamic Programming to solve it. Given an array of 2n integers,… Read More
Given a few terms of a sequence, we are often asked to find the expression for the nth term of this sequence. While there is… Read More
Double hashing is a collision resolving technique in Open Addressed Hash tables. Double hashing uses the idea of applying a second hash function to key… Read More
Definition: A loop invariant is a condition [among program variables] that is necessarily true immediately before and immediately after each iteration of a loop. (Note… Read More
Given a set (HashSet or TreeSet) of strings in Java, convert it into an array of strings. Input : Set hash_Set = new HashSet(); hash_Set.add("Geeks");… Read More
Given a string s, find the length of the longest prefix, which is also a suffix. The prefix and suffix should not overlap.  Examples:  Input… Read More
Given a range [L, R], and a prime number P. We are required to find the sum of the highest power of P in all… Read More
There is a m*n rectangular matrix whose top-left(start) location is (1, 1) and bottom-right(end) location is (m*n). There are k circles each with radius r.… Read More