Skip to content

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 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 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
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