From 9b49b3c00a595fbb7441615fea79b7fbc2694c99 Mon Sep 17 00:00:00 2001 From: Mohammad Sajid Anwar Date: Mon, 15 Sep 2025 23:14:39 +0100 Subject: - Added solutions by Andreas Mahnke. - Added solutions by E. Choroba. - Added solutions by Eric Cheung. - Added solutions by W. Luis Mochan. - Added solutions by Peter Campbell Smith. - Added solutions by Peter Meszaros. - Added solutions by Thomas Kohler. --- challenge-339/eric-cheung/python/ch-2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 challenge-339/eric-cheung/python/ch-2.py (limited to 'challenge-339/eric-cheung/python/ch-2.py') diff --git a/challenge-339/eric-cheung/python/ch-2.py b/challenge-339/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..08f9ccac92 --- /dev/null +++ b/challenge-339/eric-cheung/python/ch-2.py @@ -0,0 +1,11 @@ + +## arrGain = [-5, 1, 5, -9, 2] ## Example 1 +## arrGain = [10, 10, 10, -25] ## Example 2 +## arrGain = [3, -4, 2, 5, -6, 1] ## Example 3 +## arrGain = [-1, -2, -3, -4] ## Example 4 +arrGain = [-10, 15, 5] ## Example 5 + +arrOutput = [0] +arrOutput = arrOutput + [sum(arrGain[:nIndx + 1]) for nIndx in range(len(arrGain))] + +print (max(arrOutput)) -- cgit