Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v in the ordering. T...

Share

A number is called as a Jumping Number if all adjacent digits in it differ by 1. The difference between ‘9’ and ‘0’ is not considered as 1...

Share

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. Order of elements in outpu...

Share

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 given array. It is given that ll array ...

Share

Given that integers are being read from a data stream. Find median of all the elements read so far starting from the first integer till the last integer. This is also...

Share

Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and pl...

Share

Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no duplicates. For example, let...

Share

Given a singly linked list, write a function to swap elements pairwise. For example, if the linked list is 1->2->3->4->5 then the function should change ...

Share

Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s.
Example:
Input matrix
0 1 1 1
0 0 1 1
1 1 1 1 // this row has maximum...

Share

Create a data structure twoStacks that represents two stacks. Implementation of twoStacks should use only one array, i.e., both stacks should use the same array for s...

Share