From fbc84e7a3154b2c3f9a998ce64ba25c4206e69c6 Mon Sep 17 00:00:00 2001 From: luismanuel1989 <45186410+luismanuel1989@users.noreply.github.com> Date: Sat, 6 Mar 2021 12:38:24 -0500 Subject: [PATCH] Update solution.java if A[N - 1] is <= 0, then tmp2 is always less than tmp1. You have very good solutions by the way. Congratualtions. --- Lesson 06 - Sorting/MaxProductOfThree/solution.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lesson 06 - Sorting/MaxProductOfThree/solution.java b/Lesson 06 - Sorting/MaxProductOfThree/solution.java index cfd7a31..0ea5e19 100644 --- a/Lesson 06 - Sorting/MaxProductOfThree/solution.java +++ b/Lesson 06 - Sorting/MaxProductOfThree/solution.java @@ -15,7 +15,7 @@ public int solution(int[] A) { if (A[N - 1] > 0) { return A[N - 1] * ((tmp1 > tmp2) ? tmp1 : tmp2); } else { - return A[N - 1] * ((tmp1 < tmp2) ? tmp1 : tmp2); + return A[N - 1] * tmp2; } }