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:
parent
49453b34b9
commit
b8af7f3e38
1 changed files with 11 additions and 0 deletions
11
go/find-center-of-star-graph.go
Normal file
11
go/find-center-of-star-graph.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue