##
Min-Max Range Queries in Array
September 11, 2016

Given an array arr[0 . . . n-1]. We need to efficiently find the minimum and maximum value from index qs (query start) to qe… Read More »

September 11, 2016

Given an array arr[0 . . . n-1]. We need to efficiently find the minimum and maximum value from index qs (query start) to qe… Read More »

August 9, 2016

Given a dictionary of words where each word follows CamelCase notation, print all words in the dictionary that match with a given pattern consisting of… Read More »

July 26, 2016

Given an array of integers, evaluate queries of the form LCM(l, r). There might be many queries, hence evaluate the queries efficiently. LCM (l, r)… Read More »

July 24, 2016

Prerequisites : BIT, DFS Given a rooted tree T, with ‘n’ nodes, each node has a color denoted by the array color[](color[i] denotes the color… Read More »

July 21, 2016

Prerequisites : Suffix Array | Set 2 kasai’s algorithm The Longest Common Extension (LCE) problem considers a string s and computes, for each pair (L… Read More »

July 16, 2016

Prerequisite – Fenwick Tree We know that to answer range sum queries on a 1-D array efficiently, binary indexed tree (or Fenwick Tree) is the… Read More »

July 15, 2016

Pre-requisite : BIT(Binary Indexed Tree or Fenwick Tree), 2D BIT Given a 2D plane, respond to Q queries, each of the following type: Insert x… Read More »

July 1, 2016

Given an empty set initially and a number of queries on it, each possibly of the following types: Insert – Insert a new element ‘x’.… Read More »

June 27, 2016

Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »

June 26, 2016

Given a very long list of URLs, find out last unique URL. Only one traversal of all URLs is allowed.

June 23, 2016

Given a set of strings, find the longest common prefix. Input : {“geeksforgeeks”, “geeks”, “geek”, “geezer”} Output : “gee” Input : {“apple”, “ape”, “april”} Output… Read More »

June 13, 2016

Given an array arr[] of n numbers and an integer k, find length of the minimum sub-array with gcd equals to k. Example: Input: arr[]… Read More »

June 9, 2016

Given an array a[0 . . . n-1]. We should be able to efficiently find the GCD from index qs (query start) to qe (query… Read More »

May 24, 2016

Consider a situation with a number of persons and following tasks to be performed on them. Add a new friendship relation, i.e., a person x… Read More »

May 18, 2016

Prerequisite : LCA basics, Disjoint Set Union by Rank and Path Compression We are given a tree(can be extended to a DAG) and we have… Read More »