Skip to content

Commit

Permalink
Update Solution.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Jul 13, 2023
1 parent 48e20a1 commit 480ceb8
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Solution {
private lateinit var graph: Array<ArrayList<Int>?>
private var sum = 0
private var ret = 0

fun collectTheCoins(coins: IntArray, edges: Array<IntArray>): Int {
n = coins.size
this.coins = coins
Expand Down Expand Up @@ -37,11 +38,9 @@ class Solution {
s += r
}
}

if (pre != -1 && sum - s - coins[node] - coins[pre] > 0) {
cnt++
}

if (cnt >= 2) {
ret++
}
Expand Down

0 comments on commit 480ceb8

Please sign in to comment.