egonSchiele / grokking_algorithms

Code for the book Grokking Algorithms (https://amzn.to/29rVyHf)
Other
11.72k stars 3.8k forks source link

Create 04_recursive_max.py #249

Closed k1borgG closed 1 year ago

k1borgG commented 1 year ago

Problem with max definition. If in input list last element is the biggest, the present algorithm is'n count it. I solved this problem by changing the return in the case if length == 1 from return 1 to first element of list.