fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int upperBound(vector<int> &arr, int x, int n){
  4. // Write your code here.
  5. int l=0,h=n-1;
  6. while(l<=h){
  7. int m=(l+h)/2;
  8. if(arr[m]==x){
  9. l=m+1;
  10. }else if(arr[m]>x){
  11. h=m-1;
  12. }else{
  13. l=m+1;
  14. }
  15. }
  16. return l;
  17. }
  18. int main() {
  19. // your code goes here
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Standard output is empty