Python Please Define a function max_run(lst: list) -> int to find the maximum run in a list. A run is a subsequence with identifical values. For example, in [1, 1, 2, 2, 3, 4, 4, 4, 2, 4, 4], the runs...


Python Please


Define a function max_run(lst: list) -> int to find the maximum run in a list. A run is a subsequence with identifical values. For example, in [1, 1, 2, 2, 3, 4, 4, 4, 2, 4, 4], the runs are [1, 1], [2, 2], [3], [4, 4, 4], [2], and [4, 4]. The longest run is [4, 4, 4], which has 3 elements. max_run([1, 1, 2, 2, 3, 4, 4, 4, 2, 4, 4]) should return 3. max_run([]) == 0, max_run([1, 2, 3]) = 1, and max_run([1, 2, 1, 1]) = 2.



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here