mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 18:38:39 +00:00
Handle empty input case in Segment Tree build process (#8718)
This commit is contained in:
parent
629eb86ce0
commit
0b0214c42f
@ -7,6 +7,7 @@ class SegmentTree:
|
|||||||
self.st = [0] * (
|
self.st = [0] * (
|
||||||
4 * self.N
|
4 * self.N
|
||||||
) # approximate the overall size of segment tree with array N
|
) # approximate the overall size of segment tree with array N
|
||||||
|
if self.N:
|
||||||
self.build(1, 0, self.N - 1)
|
self.build(1, 0, self.N - 1)
|
||||||
|
|
||||||
def left(self, idx):
|
def left(self, idx):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user