Danny has a possible list of passwords of Manny’s facebook account. All passwords length is odd. But Danny knows that Manny is a big fan of palindromes. So, his password and reverse of his password
… Read More Interview Questions
Print all nodes that are at distance k from a leaf node
Given a Binary Tree and a positive integer k, print all nodes that are distance k from a leaf node.
Here the meaning of distance k from a leaf means k levels higher than a
Reverse a Linked List in groups of given size
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).
… Read More Example:
Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3
Output: 3->2->1->6->5->4->8->7->NULL.
Solution : Reverse a LinkedList keeping
How Radix sort works
Radix sort is simple and unique sorting method.
It sorts number with LSD and MSD ( Lease Significant Digit to Most Significant Digit)
… Read More It sorts number with LSD and MSD ( Lease Significant Digit to Most Significant Digit)
Radix Sort puts the elements in order by comparing the digits of
Max Sum in circularly situated Values
This question was asked first in FACEBOOK On Campus for Internship.
There are N trees in a circle. Each tree has a fruit value associated with it.
A bird can sit on a tree for
Find if two rectangles overlap
Given two rectangles, find if the given two rectangles overlap or not.
… Read More Note that a rectangle can be represented by two coordinates, top left and bottom right. So mainly we are given following four coordinates.
Search element in a matrix with all rows and columns in sorted order
Given a matrix containing unique numbers in which all rows and columns are in sorted order.
And You have to search an element output its location row,column number .
If no such element the just
… Read More And You have to search an element output its location row,column number .
If no such element the just
Implement LRU Cache
Generally Interviewer can ask you simply to implement LRU cache, first explain which data structure you will use and why.
Its well known coding question being asked by all Tech giants like Amazon , Flipkart,
Given Set of words or A String find whether chain is possible from these words or not
You are given N strings or N words. You have to find whether a chain can be formed with all the strings given namely n ?
Chain : A chain can be formed between 2
Sort an array according to the order defined by another array
Sort an array according to the order defined by another array
Given two arrays A1[] and A2[], sort A1 in such a way that the relative order among the elements will be same as those
Given two arrays A1[] and A2[], sort A1 in such a way that the relative order among the elements will be same as those