Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit067e39d

Browse files
author
Egoscio
authored
Made Matrix equality comparison deep.
Solution to the issueTheAlgorithms#719
1 parent5a934c1 commit067e39d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎DataStructures/Matrix/Matrix.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ public Matrix multiply(Matrix other) throws RuntimeException {
211211
* @return boolean
212212
*/
213213
publicbooleanequals(Matrixother) {
214-
returnthis ==other;
214+
for (inti =0;i <this.data.length;i++)
215+
for (intj =0;j <this.data[0].length;j++)
216+
if (this.data[i][j] !=other.data[i][j])
217+
returnfalse;
218+
219+
returntrue;
215220
}
216221

217222
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp