g1701_1800.s1791_find_center_of_star_graph.Solution.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-kotlin Show documentation
Show all versions of leetcode-in-kotlin Show documentation
Kotlin-based LeetCode algorithm problem solutions, regularly updated
package g1701_1800.s1791_find_center_of_star_graph
// #Easy #Graph #2023_06_18_Time_476_ms_(91.67%)_Space_69.6_MB_(95.83%)
class Solution {
fun findCenter(edges: Array): Int {
return if (edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1]) {
edges[0][0]
} else edges[0][1]
}
}