Skip to content

Commit df90571

Browse files
committed
Runtime: 436 ms (Top 21.75%) | Memory: 68.2 MB (Top 42.59%)
1 parent 7ef3db5 commit df90571

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/algorithms/F/Find Center of Star Graph/Find Center of Star Graph.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
// Runtime: 436 ms (Top 21.75%) | Memory: 68.2 MB (Top 42.59%)
12
class Solution {
23
public:
34
int findCenter(vector<vector<int>>& edges) {
45
//the center of a graph will be connected to all the edges
56
//so keep a track of number of edges for every node
6-
//if number of edges is n then it is the center
7-
7+
//if number of edges is n then it is the center
8+
89
//to store the number of edges for every node
910
int n=edges.size();
1011
vector<int> mp(n+2,0);
@@ -18,6 +19,6 @@ class Solution {
1819
return edges[i][1];
1920
}
2021
return 0;
21-
22+
2223
}
23-
};
24+
};

0 commit comments

Comments
 (0)