Query the maximum value in the range [a,b]. >>> s = SegmentTree([1, 2, 3, 4, 5]) >>> s.query(1, 3) 3 >>> s.query(1, 5) 5
(self, a, b)
| 72 | return True |
| 73 | |
| 74 | def query(self, a, b): |
| 75 | """ |
| 76 | Query the maximum value in the range [a,b]. |
| 77 | |
| 78 | >>> s = SegmentTree([1, 2, 3, 4, 5]) |
| 79 | >>> s.query(1, 3) |
| 80 | 3 |
| 81 | >>> s.query(1, 5) |
| 82 | 5 |
| 83 | """ |
| 84 | return self.query_recursive(1, 0, self.N - 1, a - 1, b - 1) |
| 85 | |
| 86 | def query_recursive(self, idx, left, right, a, b): |
| 87 | """ |
no test coverage detected