# [1791\. Find Center of Star Graph](https://leetcode.com/problems/find-center-of-star-graph/) :::spoiler Solution ```cpp= class Solution { public: int findCenter(vector<vector<int>>& edges) { vector<int> first = edges[0], second = edges[1]; return (first[0] == second[0] || first[0] == second[1]) ? first[0] : first[1]; } }; ``` - 時間複雜度:$O(1)$ - 空間複雜度:$O(1)$ :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up