Tag Archives: Flipkart

Connect nodes at same level

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 two numbers represented by two lists, write a function that returns the sum list. The sum list is list representation of the addition of… Read More »

Rat in a Maze | Backtracking-2

We have discussed Backtracking and Knight’s tour problem in Set 1. Let us discuss Rat in a Maze as another example problem that can be… Read More »

Sliding Window Maximum (Maximum of all subarrays of size k)

Given an array and an integer K, find the maximum for each and every contiguous subarray of size k. Examples : Input: arr[] = {1,… Read More »

Print BST keys in the given range

Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Print all the keys of the… Read More »

Write a SortedMerge() function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which… Read More »

Maximum width of a binary tree

Given a binary tree, write a function to get the maximum width of the given tree. Width of a tree is maximum of widths of… Read More »

Queue using Stacks

The problem is opposite of this post. We are given a stack data structure with push and pop operations, the task is to implement a… Read More »

Count Inversions in an array | Set 1 (Using Merge Sort)

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »

Level order traversal in spiral form

Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. Recommended:… Read More »

Level Order Tree Traversal

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 »

Search an element in a sorted and rotated array

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array… Read More »

Find the middle of a given linked list in C and Java

Given a singly linked list, find middle of the linked list. For example, if given linked list is 1->2->3->4->5 then output should be 3. If… Read More »

Largest Sum Contiguous Subarray

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Recommended: Please solve… Read More »

Given an array A[] and a number x, check for pair in A[] with sum as x

Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S… Read More »