##
Find k pairs with smallest sums in two arrays
May 21, 2017

Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More »

May 21, 2017

Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More »

January 27, 2017

Given an array of n distinct elements, the task is to find all elements in array which have at-least two greater elements than themselves. Examples:… Read More »

January 14, 2017

Given Binary Search Tree. The task is to find sum of all elements smaller than and equal to Kth smallest element. Examples: Input : K… Read More »

January 9, 2017

Given a positive number k and an undirected graph of N nodes, numbered from 0 to N-1, each having a weight associated with it. Note… Read More »

July 30, 2015

Given an array with all distinct elements, find the largest three elements. Expected time complexity is O(n) and extra space is O(1).

July 16, 2015

Given a Binary Search Tree (BST) and a positive integer k, find the k’th smallest element in the Binary Search Tree.

June 22, 2015

Given an infinite stream of integers, find the k’th largest element at any point of time.

March 19, 2015

Given a Binary Search Tree (BST) and a positive integer k, find the k’th largest element in the Binary Search Tree.

December 1, 2014

We recommend to read following posts as a prerequisite of this post.

November 25, 2014

We recommend to read following post as a prerequisite of this post. K’th Smallest/Largest Element in Unsorted Array | Set 1

We recommend to read following post as a prerequisite of this post. K’th Smallest/Largest Element in Unsorted Array | Set 1 Given an array and… Read More »

November 23, 2014

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the… Read More »

May 22, 2014

Given an array, find the largest element in it. The solution is to initialize max as first element, then traverse the given array from second… Read More »

April 16, 2014

Given an n x n matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the given 2D… Read More »

February 15, 2011

Given root of binary search tree and K as input, find K-th smallest element in BST.