GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — algorithms/algorithms/dp/max_subarray.py at master · oldmonad/algorithms Expand file tree/ Copy pathmax_subarray.pyMore file actions 11 lines (9 loc) · 279 Bytes / Copy pathmax_subarray.pyFile metadata and controls11 lines (9 loc) · 279 Bytes 1 2 3 4 5 6 7 8 9 10 11 def max_subarray(array): max_so_far = max_now = array[0] for i in range(1, len(array)): max_now = max(array[i], max_now + array[i]) max_so_far = max(max_so_far, max_now) return max_so_far a = [1, 2, -3, 4, 5, -7, 23] print(a) print(max_subarray(a)) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |