bisect λͺ¨λμ μλ ν¨μλ€μ μ°λ©΄ μ λ ¬λ λ°°μ΄μ λν΄μ μ΄μ§ νμμΌλ‘ μΈλ±μ€λ₯Ό μ°Ύμμ€
bisect_left
μΈλ±μ€
리ν΄bisect_right
(= bisect
)
μΈλ±μ€ + 1
리ν΄import bisect
a = [1, 3, 5, 7, 9]
print(bisect.bisect_left(a, 3)) # 1
print(bisect.bisect_right(a, 3)) # 2
# ν΄λΉνλ κ°μ΄ μμ λλ λ λ€ λμΌν λμμ ν¨
print(bisect.bisect_left(a, 4)) # 2
print(bisect.bisect_right(a, 4)) # 2
insort_left
insort_right