algo-
traverse the list from the end to find the 1. let the index of last 1 be x.
count=0;
while(i not equal to x or array_length )
if(a[i]==1)count++;
else count--;
print the value
i++;
while(--count)
printf("%d",a[i++]);
On Thu, Jul 22, 2010 at 5:53 PM, UMESH KUMAR <[email protected]>wrote:
> Hello everybady,
>
> my question is:-
>
> Find the maximum length Subsequence in the given Array that contains
> only 0's and 1's elements and condition is that number of 1;s equal to the
> number of 0's.
>
> Ex:-
> Input:- 1010101110000000000
> output:-101010111000
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.