Finding prime numbers
April 23, 2010 in Uncategorized
Output all prime numbers up to a specified integer n.
April 23, 2010 in Uncategorized
Output all prime numbers up to a specified integer n.
April 21, 2010 in binary tree
Given a binary tree, find its maximum height.
April 20, 2010 in Uncategorized
Given a binary search tree, print the elements in-order iteratively without using recursion.
April 16, 2010 in dynamic programming
There is an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. Solve it without division operator and in O(n). Read the rest of this entry →
April 14, 2010 in Uncategorized
Google interview is so popular that even MIT dedicates a course to it!
» Hacking a Google Interview Course Website Read the rest of this entry →
April 13, 2010 in Uncategorized
Rotate a one-dimensional array of n elements to the right by k steps.
For instance, with n=7 and k=3, the array {a, b, c, d, e, f, g} is rotated to {e, f, g, a, b, c, d}.
April 13, 2010 in Uncategorized
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you find an element in the rotated array efficiently? You may assume no duplicate exists in the array.
April 12, 2010 in Uncategorized
Given a set S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the set which gives the sum of zero. Read the rest of this entry →
April 12, 2010 in Uncategorized
Given a 2D point and a rectangle, determine if the point is inside the rectangle.
April 12, 2010 in Uncategorized
Implement the reversal of a singly linked list iteratively and recursively.