Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c8a345e

Browse files
committedFeb 4, 2025·
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cae97f0 commit c8a345e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎data_structures/arrays/prefix_sum.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def get_sum(self, start: int, end: int) -> int:
2020
if start < 0 or end >= len(self.prefix_sum) or start > end:
2121
raise ValueError("Invalid range specified.")
2222

23-
return self.prefix_sum[end] if start == 0 else self.prefix_sum[end] - self.prefix_sum[start - 1]
23+
return (
24+
self.prefix_sum[end]
25+
if start == 0
26+
else self.prefix_sum[end] - self.prefix_sum[start - 1]
27+
)
2428

2529
def contains_sum(self, target_sum: int) -> bool:
2630
"""
@@ -37,4 +41,5 @@ def contains_sum(self, target_sum: int) -> bool:
3741

3842
if __name__ == "__main__":
3943
import doctest
44+
4045
doctest.testmod()

0 commit comments

Comments
 (0)
Please sign in to comment.