@@ -23,7 +23,10 @@ class Solution {
2323 var s: Long = 0
2424 for (i in 0 .. < r.size - 1 ) {
2525 s + = r[i].toLong()
26- if (s * 2 == total || s * 2 - grid[i][n - 1 ] == total || s * 2 - grid[i][0 ] == total || s * 2 - grid[0 ][0 ] == total || s * 2 - grid[0 ][n - 1 ] == total) {
26+ if (s * 2 == total || s * 2 - grid[i][n - 1 ] == total ||
27+ s * 2 - grid[i][0 ] == total || s * 2 - grid[0 ][0 ] == total ||
28+ s * 2 - grid[0 ][n - 1 ] == total
29+ ) {
2730 return true
2831 }
2932 if (s * 2 > total) {
@@ -33,7 +36,10 @@ class Solution {
3336 s = 0
3437 for (i in m - 1 downTo 0 ) {
3538 s + = r[i].toLong()
36- if (s * 2 == total || s * 2 - grid[i][n - 1 ] == total || s * 2 - grid[i][0 ] == total || s * 2 - grid[m - 1 ][n - 1 ] == total || s * 2 - grid[m - 1 ][0 ] == total) {
39+ if (s * 2 == total || s * 2 - grid[i][n - 1 ] == total ||
40+ s * 2 - grid[i][0 ] == total || s * 2 - grid[m - 1 ][n - 1 ] == total ||
41+ s * 2 - grid[m - 1 ][0 ] == total
42+ ) {
3743 return true
3844 }
3945 if (s * 2 > total) {
@@ -45,7 +51,9 @@ class Solution {
4551 for (ints in grid) {
4652 s + = ints[i].toLong()
4753 }
48- if (s * 2 == total || s * 2 - grid[0 ][0 ] == total || s * 2 - grid[m - 1 ][0 ] == total || s * 2 - grid[0 ][i] == total || s * 2 - grid[m - 1 ][i] == total) {
54+ if (s * 2 == total || s * 2 - grid[0 ][0 ] == total || s * 2 - grid[m - 1 ][0 ] == total ||
55+ s * 2 - grid[0 ][i] == total || s * 2 - grid[m - 1 ][i] == total
56+ ) {
4957 return true
5058 }
5159 if (s * 2 > total) {
@@ -57,7 +65,9 @@ class Solution {
5765 for (j in m - 1 downTo 0 ) {
5866 s + = grid[j][i].toLong()
5967 }
60- if (s * 2 == total || s * 2 - grid[m - 1 ][n - 1 ] == total || s * 2 - grid[0 ][n - 1 ] == total || s * 2 - grid[0 ][i] == total || s * 2 - grid[m - 1 ][i] == total) {
68+ if (s * 2 == total || s * 2 - grid[m - 1 ][n - 1 ] == total || s * 2 - grid[0 ][n - 1 ] == total ||
69+ s * 2 - grid[0 ][i] == total || s * 2 - grid[m - 1 ][i] == total
70+ ) {
6171 return true
6272 }
6373 if (s * 2 > total) {
0 commit comments