1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-09 15:59:06 +01:00

go: add «1791. Find Center of Star Graph»

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-06-27 22:13:20 +02:00
parent 49453b34b9
commit b8af7f3e38
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -0,0 +1,11 @@
package main
func findCenter(edges [][]int) int {
u, v := edges[0][0], edges[0][1]
s, t := edges[1][0], edges[1][1]
if u == s || u == t {
return u
}
return v
}