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

Commitcff07aa

Browse files
authored
Create 0997-find-the-town-judge.kt
1 parente5b79f6 commitcff07aa

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎kotlin/0997-find-the-town-judge.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
classSolution {
2+
funfindJudge(n:Int,trust:Array<IntArray>):Int {
3+
val delta=IntArray (n+1)
4+
5+
for ((src, dst)in trust) {
6+
delta[i]++
7+
delta[o]--
8+
}
9+
10+
for (iin1..n) {
11+
if (delta[i]== n-1)
12+
return i
13+
}
14+
15+
return-1
16+
}
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp