#include<stdio.h>
#include<conio.h>
int count=0,ind=-1,len,i=0;
void largestNegSubset(int arr[])
{
if(i>len)
return ;
int t=0;
while(arr[i++]<0&&i<=len)t++;
if(t>count){count=t;ind=i-1;}
largestNegSubset(arr);
}
int main()
{
    int arr[]={1,0,1,-6,-7,-2,-2,4,-3,-5,-6,7,-8,-9};
    len=(sizeof(arr)/sizeof(int));
    largestNegSubset(arr);
    for(i=ind-1;i>(ind-count-1);i--)
    printf("%d,",arr[i]);
    getch();
    return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to