#include <bits/stdc++.h>
int minimumNet(int n, int k, vector<bool> fish)
{
int count = 0;
for(int i=0;i<n;i++)
{
if(fish[i]==1) count++;
}
if(count<k) return -1;
else if(k==1 && count>=1) return 1;
count = 0;
int mini = INT_MAX;
for(int i=0;i<n-1;i++)
{
if(fish[i]==1)
{
count++;
for(int j=i+1;j<n;j++)
{
if(fish[j]==1)
{
count++;
if (count == k)
{
mini = min(mini, j - i + 1); //3-0 is actually 4 so, +1
//cout<<"mini="<<mini<<endl;
break;
}
//cout<<"ival= "<<i<<" if"<<endl;
}
//cout<<"for"<<endl;
}
}
else
{
//cout<<"ELSE"<<endl;
count = 0;
}
//cout<<"-------------------------------"<<endl;
}
return mini;
}
All the test cases are not getting passed?….What exactly is the error?