[algogeeks] Generating permutations with constraints

2011-02-10 Thread Nipun Batra
Given two sets of strings set a="b8","b7""b1" set b="c2","c1","c0" I wish to list out all the permutations of the form b8c2 b7c2 b6c1 b5c1 b5c0 b5c0 b1c0 b1c0 of length 8 each wherein the ordering is maintained like non increasing indices from set a and also from set b. A more formal def

Re: [algogeeks] Re: Microsoft interview question

2010-08-22 Thread nipun batra
Maybe to reduce the memory usage and to include all types of characters we could create a one to one mapping between the character and the number of occurrences.And while retrieving start from reverse checking the mapping value,print if it's one. On Sun, Aug 22, 2010 at 7:59 PM, Saikat Debnath wro

Re: [algogeeks] Longest Palindromic Substring

2010-08-21 Thread nipun batra
An O(n^3) solution.Wanna know if it's possible to optimize without using trees. #include #include using namespace std; char* substring(char*s,int start,int finish) { int ctr=0; char str[1000]; while(start<=finish) { str[ctr]=s[start];