problem
Common Ancestor in a Binary Tree or Binary Search Tree
[1] / \ [2] [3] / \ / \ [4] [5] [9] [10] / / \ [8] [6] [7]
say
Password Predictor
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
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
Advanced SQL Injection
First Try to find out which websites may be Hackable from SQL Injection.
Website which has
.aspx?id=1
.php?category=1
.php?cat=2
.php?id=5426(any id)
Generate next palindrome number
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
How Radix sort works
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.
Find if two rectangles overlap
Note that a rectangle can be represented by two coordinates, top left and bottom right. So mainly we are given following four coordinates.