[algogeeks] Re: Permuatation containing given element

2006-10-26 Thread Karthik Singaram L
/* Assume inp is the given array*/static int bitmap[N][N];int lengths[N];int currentBitmap = -1;int active = 1;int lastPos;for(i=0;i{  if(inp[i]==1)  {   currentBitmap++;    active=1;   lastPos=i;  }  if(active==1)  {   if(bitmap[currentBitmap][inp[i]]==1)    {    active=0;    lengths[currentBitmap

[algogeeks] Re: Permuatation containing given element

2006-10-26 Thread Arunachalam
Oops worng test case On 10/26/06, Arunachalam <[EMAIL PROTECTED]> wrote: Hi, You are given an array A of Length N , 1 <= A[i] <= N , for each valid i. Now you are given an valid index m. Now we need to find the length of the largest permutation starting with 1 which contains A[m].   For exa