# Tag Archives: Ola Cabs

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More
Given that integers are read from a data stream. Find median of elements read so for in an efficient way. For simplicity assume, there are… Read More
Given a boolean matrix mat[M][N] of size M X N, modify it such that if a matrix cell mat[i][j] is 1 (or true) then make… Read More
Given an n x n matrix and a number x, find the position of x in the matrix if it is present in it. Otherwise,… Read More
Given a root of a tree, and an integer k. Print all the nodes which are at k distance from root. For example, in the below… Read More
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put… Read More
Given an array arr[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number. … Read More
Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7.    … Read More
A node is a leaf node if both left and right child nodes of it are NULL. Here is an algorithm to get the leaf node… Read More
Level order traversal of a tree is breadth first traversal for the tree.  Level order traversal of the above tree is 1 2 3 4… Read More
Given a string, find the first non-repeating character in it. For example, if the input string is “GeeksforGeeks”, then the output should be ‘f’ and… Read More
You are given a Double Link List with one pointer of each node pointing to the next node just like in a single link list.… Read More
Mirror of a Tree: Mirror of a Binary Tree T is another Binary Tree M(T) with left and right children of all non-leaf nodes interchanged.  … Read More
You are given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in the… Read More
Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum.    Recommended: Please… Read More