From 045da04e63323acdfffc3d1a0cd92bf0853364b0 Mon Sep 17 00:00:00 2001 From: Simon Green Date: Sun, 14 Sep 2025 22:54:18 +1000 Subject: sgreen solutions to challenge 338 --- challenge-338/sgreen/python/ch-1.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 challenge-338/sgreen/python/ch-1.py (limited to 'challenge-338/sgreen/python/ch-1.py') diff --git a/challenge-338/sgreen/python/ch-1.py b/challenge-338/sgreen/python/ch-1.py new file mode 100755 index 0000000000..f91a214ebe --- /dev/null +++ b/challenge-338/sgreen/python/ch-1.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import json +import sys + + +def highest_row(matrix: list[list[int]]) -> int: + """Return the highest sum of any row in the matrix. + + Args: + matrix: A list of lists of integers. + + Returns: + The highest sum of any row in the matrix. + """ + return max(sum(row) for row in matrix) + + +def main(): + # Convert input into a matrix + matrix = json.loads(sys.argv[1]) + result = highest_row(matrix) + print(result) + + +if __name__ == '__main__': + main() -- cgit