MCPcopy
hub / github.com/doocs/leetcode / modifyAdd

Method modifyAdd

solution/1600-1699/1622.Fancy Sequence/Solution.py:20–34  ·  view source on GitHub ↗
(self, l, r, inc, node=None)

Source from the content-addressed store, hash-verified

18 self.root = Node(1, int(1e5 + 1))
19
20 def modifyAdd(self, l, r, inc, node=None):
21 if l > r:
22 return
23 if node is None:
24 node = self.root
25 if node.l >= l and node.r <= r:
26 node.v = (node.v + (node.r - node.l + 1) * inc) % MOD
27 node.add += inc
28 return
29 self.pushdown(node)
30 if l <= node.mid:
31 self.modifyAdd(l, r, inc, node.left)
32 if r > node.mid:
33 self.modifyAdd(l, r, inc, node.right)
34 self.pushup(node)
35
36 def modifyMul(self, l, r, m, node=None):
37 if l > r:

Callers 2

appendMethod · 0.45
addAllMethod · 0.45

Calls 2

pushdownMethod · 0.95
pushupMethod · 0.95

Tested by

no test coverage detected