Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/scenarios/test-scenario-fix-python/case3.py
13397 views
1
# Copyright (c) Microsoft Corporation and GitHub. All rights reserved.
2
3
def subarray_min_max_sum(l):
4
# given an array of size n > 1 comute min and max of sums of all subarrays of size n-1
5
# if n <= 1 return None
6
# return a tuple (min_sum,max_sum)
7
8
if len(l)<=1:
9
return 0
10
complete_sum = sum(l)
11
min_sum = 0
12
max_sum = 0
13
for x in l:
14
temp_sum = complete_sum - x
15
min_sum = min(min_sum,temp_sum)
16
max_sum = max(max_sum,temp_sum)
17
return min_sum,max_sum
18
19