From 8ddf5cadc88c0f694d8266e4d6395943bbbdbbab Mon Sep 17 00:00:00 2001
From: kwakobo <11098108+kwakobo@users.noreply.github.com>
Date: Tue, 8 Jul 2025 10:20:26 -0700
Subject: [PATCH] Update space complexity
---
hints/clone-graph.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hints/clone-graph.md b/hints/clone-graph.md
index 1e332bf4a..eba189796 100644
--- a/hints/clone-graph.md
+++ b/hints/clone-graph.md
@@ -2,7 +2,7 @@
- You should aim for a solution with Recommended Time & Space Complexity
O(V + E)
time and O(E)
space, where V
is the number of vertices and E
is the number of edges in the given graph.
+ You should aim for a solution with O(V + E)
time and O(V)
space, where V
is the number of vertices and E
is the number of edges in the given graph.
We stop this recursive path when we encounter a node that has already been cloned or visited. This DFS approach creates an exact clone of the given graph, and we return the clone of the given node.
- \ No newline at end of file +