From 171c28a1cab1e35762a6796a894c8306606f7c06 Mon Sep 17 00:00:00 2001 From: halfrost Date: Thu, 6 Apr 2023 21:06:11 -0700 Subject: [PATCH] Add max function in 1004 --- .../ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/content/ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md b/website/content/ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md index c7c40384d..8731490ef 100644 --- a/website/content/ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md +++ b/website/content/ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md @@ -77,6 +77,13 @@ func longestOnes(A []int, K int) int { return res } +func max(a int, b int) int { + if a > b { + return a + } + return b +} + ```