Similar String Groups is a HARD problem from LeetCode 839. This is again solved using my 3 simple steps techniques of DFS. See yourself how can we use the DFS approach to solve this problem easily. Many solutions given in leetcode for this problem are not very easy to understand and vague in nature. I attempted this to give a cleaner and easier approach for the candidates. https://rebrand.ly/interviewdose . #leetcode #dfs #faang
LeetCode Problem : https://leetcode.com/problems/similar-string-groups/
MySolution : https://github.com/interviewdose/id/blob/master/similar-string-groups/Solution.java
Time complexity for this solution is O(N squared * W) .
You can also use Union-Find for a better timed optimized solution.
We are given a list A of strings. Every string in A is an anagram of every other string in A. How many groups are there? Let me know if you have seen this solution or attempted this approach also write the time complexity for this solution in comment section.
#dfs #interviewdose
Download
0 formats
No download links available.
Leetcode 839. Similar String Groups || Google interview question | NatokHD