1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00
LeetCode/go/find-center-of-star-graph.go
Matej Focko b8af7f3e38
go: add «1791. Find Center of Star Graph»
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-06-27 22:13:20 +02:00

11 lines
169 B
Go

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
}