##
Queries on substring palindrome formation
February 2, 2017

Given a string S, and two type of queries. Type 1: 1 L x, Indicates update Lth index of string S by x character. Type… Read More »

February 2, 2017

Given a string S, and two type of queries. Type 1: 1 L x, Indicates update Lth index of string S by x character. Type… Read More »

February 1, 2017

Given n strings and a weight associated with each string. The task is to find the maximum weight of string having the given prefix. Print… Read More »

January 19, 2017

In previous posts, we have discussed how to calculate the Lowest Common Ancestor (LCA) for a binary tree and a binary search tree (this, this… Read More »

January 11, 2017

Given a Binary Matrix. The task is to find the pair of row in the Binary matrix that has maximum bit difference Examples: Input: mat[][]… Read More »

January 10, 2017

Given a string of length n of lowercase alphabet characters, we need to count total number of distinct substrings of this string. Examples: Input :… Read More »

January 7, 2017

Given a matrix A of size NxN, we need to find the number of inversion pairs in it. Inversion count in a matrix is defined… Read More »

December 21, 2016

Given an array of integers, find the minimum (or maximum) element and the element just greater (or smaller) than that in less than 2n comparisons.… Read More »

November 30, 2016

November 24, 2016

Given a matrix of size M x N, there are large number of queries to find submatrix sums. Inputs to queries are left top and… Read More »

October 18, 2016

Like array and linked list, unrolled Linked List is also a linear data structure and is a variant of linked list. Unlike simple linked list,… Read More »

October 10, 2016

Let us consider the below problem statement and think of different solutions for it. Given a set S of elements such that the elements are… Read More »

October 9, 2016

Given a list of contacts which exist in a phone directory. The task is to implement search query for the phone directory. The search query… Read More »

October 6, 2016

Given an array arr[0..n-1]. The following operations need to be performed. update(l, r, val) : Add ‘val’ to all the elements in the array from… Read More »

October 1, 2016

Given a size n in which initially all elements are 0. The task is to perform multiple multiple queries of following two types. The queries… Read More »

September 30, 2016