diff --git a/Java/Ch 05. Bit Manipulation/Q5_03_Flip_Bit_to_Win/QuestionB.java b/Java/Ch 05. Bit Manipulation/Q5_03_Flip_Bit_to_Win/QuestionB.java index 421c8bb9..e147092f 100644 --- a/Java/Ch 05. Bit Manipulation/Q5_03_Flip_Bit_to_Win/QuestionB.java +++ b/Java/Ch 05. Bit Manipulation/Q5_03_Flip_Bit_to_Win/QuestionB.java @@ -44,7 +44,7 @@ public static int findLongestSequence(ArrayList seq) { int thisSeq = 0; if (zerosSeq == 1) { // Can merge thisSeq = onesSeqLeft + 1 + onesSeqRight; - } if (zerosSeq > 1) { // Just add a zero to either side + } else if (zerosSeq > 1) { // Just add a zero to either side thisSeq = 1 + Math.max(onesSeqRight, onesSeqLeft); } else if (zerosSeq == 0) { // No zero, but take either side thisSeq = Math.max(onesSeqRight, onesSeqLeft);