From 1d073851f64d0b9edfb3966c3bf788528e72bbf4 Mon Sep 17 00:00:00 2001 From: Mohammad Sajid Anwar Date: Mon, 8 Sep 2025 09:10:43 +0100 Subject: - Added solutions by Andrew Shitov. - Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by Eric Cheung. - Added solutions by Niels van Dijke. --- challenge-338/eric-cheung/python/ch-1.py | 10 ++++++++++ challenge-338/eric-cheung/python/ch-2.py | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 challenge-338/eric-cheung/python/ch-1.py create mode 100755 challenge-338/eric-cheung/python/ch-2.py (limited to 'challenge-338/eric-cheung/python') diff --git a/challenge-338/eric-cheung/python/ch-1.py b/challenge-338/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..5e4a1ea8ea --- /dev/null +++ b/challenge-338/eric-cheung/python/ch-1.py @@ -0,0 +1,10 @@ + +## arrMatrix = [[4, 4, 4, 4], [10, 0, 0, 0], [2, 2, 2, 9]] ## Example 1 +## arrMatrix = [[1, 5], [7, 3], [3, 5]] ## Example 2 +## arrMatrix = [[1, 2, 3], [3, 2, 1]] ## Example 3 +## arrMatrix = [[2, 8, 7], [7, 1, 3], [1, 9, 5]] ## Example 4 +arrMatrix = [[10, 20, 30], [5, 5, 5], [0, 100, 0], [25, 25, 25]] ## Example 5 + +nHighestRowSum = max([sum(arrRowLoop) for arrRowLoop in arrMatrix]) + +print (nHighestRowSum) diff --git a/challenge-338/eric-cheung/python/ch-2.py b/challenge-338/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..f819139317 --- /dev/null +++ b/challenge-338/eric-cheung/python/ch-2.py @@ -0,0 +1,24 @@ + +## Example 1 +## arrInput_01 = [4, 5, 7] +## arrInput_02 = [9, 1, 3, 4] + +## Example 2 +## arrInput_01 = [2, 3, 5, 4] +## arrInput_02 = [3, 2, 5, 5, 8, 7] + +## Example 3 +## arrInput_01 = [2, 1, 11, 3] +## arrInput_02 = [2, 5, 10, 2] + +## Example 4 +## arrInput_01 = [1, 2, 3] +## arrInput_02 = [3, 2, 1] + +## Example 5 +arrInput_01 = [1, 0, 2, 3] +arrInput_02 = [5, 0] + +nMaxDiff = max(abs(nElem_01 - nElem_02) for nElem_01 in arrInput_01 for nElem_02 in arrInput_02) + +print (nMaxDiff) -- cgit