NISHIO Hirokazu[English][日本語]

bisect

>>> import bisect
>>> xs = [1, 2, 4, 4, 5]
>>> [bisect.bisect_left(xs, x) for x in range(7)]
[0, 0, 1, 2, 2, 4, 5]
>>> [bisect.bisect_right(xs, x) for x in range(7)]
[0, 1, 2, 2, 4, 5, 5]

image

atcoder


This page is auto-translated from /nishio/bisect using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.


(C)NISHIO Hirokazu / Converted from Markdown (en)
Source: [GitHub] / [Scrapbox]