Skip to content

Commit 1752e72

Browse files
committed
replace one 0 to get longest ones
1 parent 38a97ae commit 1752e72

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Array/ReplaceZeroOneToFindLongest1.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ public static void main(String[] strings) {
99
int[] array = new int[]{1, 0, 1, 1, 0,1, 0, 1, 1, 1, 0, 0};
1010
*/
1111
int[] array = new int[]{1, 1, 1, 1, 0,1, 1, 1, 1, 1, 1, 1};
12+
//other way
13+
//1, 1, 1, 1, 0,1, 1, 1, 1, 1, 1, 1
14+
//1, 2, 3, 4, 0,1, 2, 3, 4, 5, 6, 7
15+
//4, 4, 4, 4, 0,7, 7, 7, 7, 7, 7, 7
1216

1317
int index = -1;
1418
int maxlen = 0;

0 commit comments

Comments
 (0)