For below tree, function should print 1, 2, 3, 7, 6, 5, 4.
[1]
Interview Questions asked in Google, Microsoft, Amazon
by Dhaval Dave
[1]
by Dhaval Dave
by Dhaval Dave
Given LinkedList and K=2, N=41->2->3->4->5->6->7->8->9
so Partitioned LinkedList will be
1->2->3->4->5->6->7->8->9
Now delete first K nodes from each subpart and return
by Dhaval Dave
by Dhaval Dave
example
by Dhaval Dave
[1] / \ [2] [3] / \ / \ [4] [5] [9] [10] / / \ [8] [6] [7]
say
by Dhaval Dave
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
by Dhaval Dave
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
by Dhaval Dave
Several Companies like MS, Amazon and Flipkart has started asking this question to Generate next palindrome number.
Say K is given, Generate N such that N is palindrome and N > K.
Logic 1) Create
by Dhaval Dave
Note that a rectangle can be represented by two coordinates, top left and bottom right. So mainly we are given following four coordinates.