@@ -11,7 +11,7 @@ def __init__(self, a) -> None:
1111 if self .N :
1212 self .build (1 , 0 , self .N - 1 )
1313
14- def left (self , idx ):
14+ def left (self , idx ) -> int :
1515 """
1616 Returns the left child index for a given index in a binary tree.
1717
@@ -23,7 +23,7 @@ def left(self, idx):
2323 """
2424 return idx * 2
2525
26- def right (self , idx ):
26+ def right (self , idx ) -> int :
2727 """
2828 Returns the right child index for a given index in a binary tree.
2929
@@ -44,7 +44,7 @@ def build(self, idx, left, right) -> None:
4444 self .build (self .right (idx ), mid + 1 , right )
4545 self .st [idx ] = max (self .st [self .left (idx )], self .st [self .right (idx )])
4646
47- def update (self , a , b , val ):
47+ def update (self , a , b , val ) -> bool :
4848 """
4949 Update the values in the segment tree in the range [a,b] with the given value.
5050
@@ -71,7 +71,7 @@ def update_recursive(self, idx, left, right, a, b, val) -> bool:
7171 self .st [idx ] = max (self .st [self .left (idx )], self .st [self .right (idx )])
7272 return True
7373
74- def query (self , a , b ):
74+ def query (self , a , b ) -> float :
7575 """
7676 Query the maximum value in the range [a,b].
7777
@@ -83,7 +83,7 @@ def query(self, a, b):
8383 """
8484 return self .query_recursive (1 , 0 , self .N - 1 , a - 1 , b - 1 )
8585
86- def query_recursive (self , idx , left , right , a , b ):
86+ def query_recursive (self , idx , left , right , a , b ) -> float :
8787 """
8888 query(1, 1, N, a, b) for query max of [a,b]
8989 """
0 commit comments