-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add solution for deleting duplicate folders in a file system #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideAdds a trie-based algorithm that builds a folder tree from input paths, serializes each subtree to detect duplicates, marks duplicate nodes for deletion, and collects remaining paths; implementations are provided in Python and Go and documentation updated accordingly. Class diagram for TrieNode and Solution classes (Python)classDiagram
class TrieNode {
+dict children
+str key
+bool deleted
}
class Solution {
+deleteDuplicateFolder(paths: List[List[str]]) List[List[str]]
}
Solution --> TrieNode : uses
Class diagram for TrieNode struct and deleteDuplicateFolder function (Go)classDiagram
class TrieNode {
+map[string]*TrieNode children
+string key
+bool deleted
}
class deleteDuplicateFolder {
+deleteDuplicateFolder(paths [][]string) [][]string
}
deleteDuplicateFolder --> TrieNode : uses
Flow diagram for duplicate folder deletion processflowchart TD
A[Build Trie from paths] --> B[DFS serialize subtrees]
B --> C[Mark duplicate subtrees as deleted]
C --> D[Collect remaining paths]
D --> E[Return result]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Speccy-Rom - I've reviewed your changes - here's some feedback:
- Remove the unused
key
field from both Python and Go TrieNode definitions to simplify the data structure. - Align the duplicate-marking logic between the Python (list-based) and Go (single-instance map) implementations so they handle multiple identical subtrees in the same way.
- Reduce duplicated code in README_EN.md and README.md by consolidating the examples into a single snippet or referencing the solution files directly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Remove the unused `key` field from both Python and Go TrieNode definitions to simplify the data structure.
- Align the duplicate-marking logic between the Python (list-based) and Go (single-instance map) implementations so they handle multiple identical subtrees in the same way.
- Reduce duplicated code in README_EN.md and README.md by consolidating the examples into a single snippet or referencing the solution files directly.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add Trie-based implementations for deleting duplicate folders in Python3 and Go and update README documentation to include the new solutions.
New Features:
Documentation: