Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Upper bound using BS
Misbah_Uddin_Tareq
Apr 19th, 2020
236
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
0.25 KB
| None
|
0
0
raw
download
clone
embed
print
report
ll upper_bound
(
vector
<
ll
>
v, ll l, ll r, ll x
)
{
ll index
=
-
1
;
while
(
r
>=
l
)
{
ll mid
=
(
l
+
r
)
/
2
;
if
(
v
[
mid
]
>
x
)
{
index
=
mid
;
r
=
mid
-
1
;
}
else
l
=
mid
+
1
;
}
return
index
-
1
;
}
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
I got $12,000 from this bug
CSS | 25 min ago | 0.99 KB
This month smells like money
CSS | 35 min ago | 0.99 KB
✅ Admin Password
CSS | 56 min ago | 0.99 KB
dev loader method
CSS | 56 min ago | 0.99 KB
Module v1.3 - rate calculation bug (repro + w...
CSS | 1 hour ago | 0.99 KB
Free money using older build
CSS | 1 hour ago | 0.99 KB
Bought a $40 MacBook Air
1 day ago | 0.55 KB
My Amazon Shoppe
1 day ago | 0.40 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!