my approach is calculating number of overlapping circles.
if circles overlaps(i.e its end point < starting point of prev) , i increment my ans. otherwise i shift my prev to that circle if it is not overlapping with current prev.
not getting desired output.what conditions i am missing.update my code.
link to my code - https://ide.codingblocks.com/s/262021
Not getting desired output
@pulkit_pandey09
you first have to calculate maximum nonoverlapping circle then subtract it from n.
sort(v.begin(),v.end(),compare);
int ans = 1;
int prev=v[0].second;
for(int i=1;i<=n-1;i++){
if(v[i].first >= prev){
prev = v[i].second;
ans++;
}
}