Skip to content

Commit

Permalink
5.3: Cleaning up code to change if to else if (logic was fine -- just…
Browse files Browse the repository at this point in the history
… a typo)
  • Loading branch information
Gayle McDowell committed Nov 4, 2018
1 parent d39b432 commit 3805f6b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static int findLongestSequence(ArrayList<Integer> 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);
Expand Down

0 comments on commit 3805f6b

Please sign in to comment.