Some test cases not passing

Hi!
I’m not getting my mistake. Please help

hello @sukritbansal01

	for(int i=0; i<a.size()-1; i++){
		if(a[i+1].first<=a[i].second){
			ans++;
			
		}
	}

this comparison is wrong.
here u need to compare current circle i with last circle that u have included in ur answer.
but here u r always comparing consecutive circle

I’m no able to get that how the 2 approaches are different. Also, by using below method, I’m getting wrong answer.

for(int i=1; i<a.size(); i++){ if(a[i].first<=a[i-1].second){ ans++; } }

refer this->

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.