Skip to content

Commit ea2bc23

Browse files
author
Mohammad
committed
after ox round fix
1 parent 5ce9443 commit ea2bc23

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/test/kotlin/com/sample/umar/leetcodemediums/okx/TwoStringOfSame.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ fun main() {
2020
}
2121

2222
fun minOperationsToMakeEqual(A: String, B: String): Int {
23-
if (A.length != B.length) return -1
24-
2523
var count01 = 0
2624
var count10 = 0
2725

2826
for (i in A.indices) {
2927
if (A[i] == '0' && B[i] == '1') count01++
3028
if (A[i] == '1' && B[i] == '0') count10++
3129
}
32-
33-
return if (count01 == count10) count01 else -1
30+
return maxOf(count01, count10)
3431
}

0 commit comments

Comments
 (0)