Untitled
unknown
plain_text
2 years ago
425 B
2
Indexable
Never
int minNum(int threshold,vector<int> points) { int n=points.size(); if(points[n-1]-points[0]<threshold)return n; int l=0,r=n-1; int target=threshold+points[0]; int ind=n-1; while(l<=r) { int mid=(l+r)/2; if(points[mid]>target) { ind=mid; r=mid-1; } else l=mid+1; } return 1+ (ind+1)/2; }