Monday, June 21, 2010

Number of permutations and combinations of a string

Generic code to give the number of possible permutations and combination of a string !!

Sunday, June 20, 2010

pallindrome

find the longest palindrome in a string in linear time

[Microsoft] Puzzle: 12 balls problem

You have given 12 balls of identical shape and a weighing compares. There is one ball defective among them. How will you find out the defective one and whether it is light or heavy in less number of weighing.

Maximum Positive Difference[Amazon]

Amazon Question
There is an integer array consisting positive and negative integers. Find maximum positive difference S defined as:

S = a [i.]- a[j] where i>j
and
S > 0