From cb163154077f1f11cce1499304a099c8a63a13db Mon Sep 17 00:00:00 2001 From: Ilya Nikokoshev Date: Sat, 20 Jan 2024 16:34:47 +0100 Subject: [PATCH] Add a title --- lc_0684_redundant_connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lc_0684_redundant_connection.py b/lc_0684_redundant_connection.py index 617f80d..6c8d199 100644 --- a/lc_0684_redundant_connection.py +++ b/lc_0684_redundant_connection.py @@ -1,5 +1,6 @@ # https://leetcode.com/problems/redundant-connection/solutions/4598163/strip-out-the-leaves-and-the-cycle-is-revealed -""" +"""Strip out the leaves and the cycle is revealed. + We apply topological sort to remove everything except the cycle. Time complexity: O(n) (we perform constant operations per vertex), assuming accessing the dictionary is constant. Space complexity: O(n) (we store constant additional info per node)