aboutsummaryrefslogtreecommitdiff
path: root/challenge-339/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-15 23:14:39 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-09-15 23:14:39 +0100
commit9b49b3c00a595fbb7441615fea79b7fbc2694c99 (patch)
treef75f7e7ff98d0103413a6adf03513ed65dd6777c /challenge-339/eric-cheung/python/ch-2.py
parent7f78d729369f524a8bf4d7d9eb693aa689d78af6 (diff)
downloadperlweeklychallenge-club-9b49b3c00a595fbb7441615fea79b7fbc2694c99.tar.gz
perlweeklychallenge-club-9b49b3c00a595fbb7441615fea79b7fbc2694c99.tar.bz2
perlweeklychallenge-club-9b49b3c00a595fbb7441615fea79b7fbc2694c99.zip
- 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.
Diffstat (limited to 'challenge-339/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-339/eric-cheung/python/ch-2.py11
1 files changed, 11 insertions, 0 deletions
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))