Skip to content

Commit 0965189

Browse files
committed
LongestCommonSubsequence: no need to initialize int[] with zero, it has a zero already anyway. There's a tiny speed increase by removing the loops, but micro-benchmarking is another topic. Anyway, it certainly does not hurt to remove it.
1 parent cb812e8 commit 0965189

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/main/java/info/debatty/java/stringsimilarity/LongestCommonSubsequence.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,6 @@ public final int length(final String s1, final String s2) {
9494

9595
int[][] c = new int[m + 1][n + 1];
9696

97-
for (int i = 0; i <= m; i++) {
98-
c[i][0] = 0;
99-
}
100-
101-
for (int j = 0; j <= n; j++) {
102-
c[0][j] = 0;
103-
}
104-
10597
for (int i = 1; i <= m; i++) {
10698
for (int j = 1; j <= n; j++) {
10799
if (x[i - 1] == y[j - 1]) {

0 commit comments

Comments
 (0)