one of the practice problem have struct me off
http://www.codechef.com/problems/NOTATRI
here is the problem link i jst checked the solution and found that if we sort the array first check
as array is sorted
for(third=N-1;third>1;third--)
{
first=0;
second=third-1;
while(second>first)
{
if(len[first]+len[second]<len[third])
{
count+=second-first;
first++;
}
else
{
second--;
}
}
}
this part is the main logic for the given problem and this leads me in confusion how can we do this
count+=second-first;
↧
PRBLEM IN NOTATRI
↧