grokking_algorithms
grokking_algorithms copied to clipboard
Update 04_recursive_max.js with fix for alternative solution
Current alternative solution works only for arrays of natural numbers and for empty arrays it returns 0 instead of null or Error. This commit fixes these problems.
I like the change to add Number.MIN_VALUE. Could you remove the other function? I agree isFirstRun would make sense in production code, but the aim for this repo is readability, and I'd prefer to leave the isFirstRun logic out for that.
@egonSchiele I guess it's done, could you check this out please? Or should I remove 2 other console.log's as well?