We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83a7fd3 commit 3d579a1Copy full SHA for 3d579a1
src/hackerrank/interview_preparation_kit/arrays/cruch_optimized.py
@@ -9,17 +9,17 @@
9
LOGGER = logging.getLogger(__name__)
10
11
12
-def array_manipulation_optimized(n: int, queries: list[list[int]]) -> int:
+def array_manipulation_optimized(n_operations: int, queries: list[list[int]]) -> int:
13
# why adding 2?
14
# first slot to adjust 1-based index and
15
# last slot for storing accum_sum result
16
- result = [0] * (n + 2)
+ result = [0] * (n_operations + 2)
17
maximum = 0
18
19
- for [a, b, k] in queries:
+ for [a_start, b_end, k_value] in queries:
20
# Prefix
21
- result[a] += k
22
- result[b + 1] -= k
+ result[a_start] += k_value
+ result[b_end + 1] -= k_value
23
24
accum_sum = 0
25
for value in result:
0 commit comments