From 3f3006383264705043b88be9c77e1f34265858eb Mon Sep 17 00:00:00 2001 From: Kshitiz Sharma <110187324+kshitiz11101@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:51:40 +0530 Subject: [PATCH] Create CenterOfGraph.cpp --- Graphs/CenterOfGraph.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Graphs/CenterOfGraph.cpp diff --git a/Graphs/CenterOfGraph.cpp b/Graphs/CenterOfGraph.cpp new file mode 100644 index 0000000..31e9114 --- /dev/null +++ b/Graphs/CenterOfGraph.cpp @@ -0,0 +1,9 @@ +class Solution { +public: + int findCenter(vector>& edges) { + if(edges[0][0]==edges[1][0] || edges[0][0]==edges[1][1]){ + return edges[0][0]; + } + return edges[0][1]; + } +};