-
-
Notifications
You must be signed in to change notification settings - Fork 155
Docs: Added Solutions to Leetcode 609 #1411
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
Docs: Added Solutions to Leetcode 609 #1411
Conversation
Here's the code health analysis summary for commits Analysis Summary
|
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.
Great job, @shreyash3087! 🎉 Thank you for submitting your pull request to CodeHarborHub. We appreciate your contribution and enthusiasm! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Thanks for contributing!
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.
update your code based on suggestions
|
||
### Constraints | ||
|
||
- $1 <= paths.length <= 2 * 10^4$ |
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.
basic practice
$1 <= paths.length <= 2 * 10^4$
Good Practice
$1 \leq \text{paths.length} \leq 2 \times 10^4$
### Constraints | ||
|
||
- $1 <= paths.length <= 2 * 10^4$ | ||
- $1 <= paths[i].length <= 3000$ |
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.
also, replace - $1 <= paths[i].length <= 3000$
to best or Good practice
|
||
## Solution for Find Duplicate File in System | ||
|
||
### Approach #1 Brute Force [Time Limit Exceeded] |
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.
replace #1
to 1
|
||
> **Reason**: Size of lists res and list can grow upto n∗x. | ||
|
||
### Approach #2 Using HashMap |
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.
replace #2
to 2
|
||
> **Reason**: Creation of list will take O(n∗x), where n is the number of directories and x is the average string length. Every file is compared with every other file. Let f files are there with average size of s, then files comparision will take O(f2∗s), equals can take O(s). Here, Worst case will be when all files are unique. | ||
|
||
### Space Complexity: $O(n*x)$ |
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.
replace $O(n*x)$
to $O(n \times x)$
|
||
## Complexity Analysis | ||
|
||
### Time Complexity: $O(n*x + f^2 * s)$ |
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.
replace $O(n*x + f^2 * s)$
to $O(n \times x + f^2 \times s)$
|
||
> **Reason**: n strings of average length x is parsed. | ||
|
||
### Space Complexity: $O(n*x)$ |
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.
also, update $O(n*x)$
to best practice
@ajay-dhangar Done |
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.
Done
Related Issue
Closes #1376
Description
This PR adds the solution to leetcode problem 609 - (Find Duplicate File in System)
Type of PR
Screenshots / Videos (if applicable)
Checklist
Additional Context
N/A