grokking_algorithms icon indicating copy to clipboard operation
grokking_algorithms copied to clipboard

Update 04_recursive_max.js with fix for alternative solution

Open TrayHard opened this issue 2 years ago • 2 comments

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.

TrayHard avatar Jun 09 '23 15:06 TrayHard

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 avatar Aug 08 '23 23:08 egonSchiele

@egonSchiele I guess it's done, could you check this out please? Or should I remove 2 other console.log's as well?

TrayHard avatar Dec 05 '23 17:12 TrayHard