Skip to content

Commit 3d579a1

Browse files
author
Gonzalo Diaz
committed
[REFACTOR] clean code: variable naming
1 parent 83a7fd3 commit 3d579a1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/hackerrank/interview_preparation_kit/arrays/cruch_optimized.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
LOGGER = logging.getLogger(__name__)
1010

1111

12-
def array_manipulation_optimized(n: int, queries: list[list[int]]) -> int:
12+
def array_manipulation_optimized(n_operations: int, queries: list[list[int]]) -> int:
1313
# why adding 2?
1414
# first slot to adjust 1-based index and
1515
# last slot for storing accum_sum result
16-
result = [0] * (n + 2)
16+
result = [0] * (n_operations + 2)
1717
maximum = 0
1818

19-
for [a, b, k] in queries:
19+
for [a_start, b_end, k_value] in queries:
2020
# Prefix
21-
result[a] += k
22-
result[b + 1] -= k
21+
result[a_start] += k_value
22+
result[b_end + 1] -= k_value
2323

2424
accum_sum = 0
2525
for value in result:

0 commit comments

Comments
 (0)