-
-
Notifications
You must be signed in to change notification settings - Fork 155
Add Solution to LeetCode Problem 1547 (Hard) #3620
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
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, @sreevidya-16! 🎉 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!
Here's the code health analysis summary for commits Analysis Summary
|
⚡️ Lighthouse Report for the Deploy Preview of this PR 🚀🔗 Site: CodeHarborHub | Live Site
|
@ajay-dhangar This Pull request Fixes #3607 issue |
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 code based on suggestions
|
||
- 2 <= `n` <= 10^6 | ||
- 1 <= `cuts.length` <= min(`n` - 1, 100) | ||
- 1 <= `cuts[i]` <= `n` - 1 | ||
- All the integers in the `cuts` array are distinct. | ||
|
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 <
with <
in lines 52 to 54.
- This takes O(m^3) time in the worst case. | ||
|
||
- **Overall Time Complexity**: | ||
- The overall time complexity is O(m^3). |
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(m^3)
with $O(m^3)$
|
||
- **DP Table Calculation**: | ||
- Filling the `dp` table involves iterating over all possible subintervals and calculating the minimum cost for each subinterval using nested loops. | ||
- This takes O(m^3) time in the worst case. |
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(m^3)
with $O(m^3)$
- **Initialization**: | ||
- Sorting the cuts array takes O(m log m) time, where m is the number of cuts. | ||
- Initializing the `dp` array takes O(m^2) time. | ||
- Overall initialization time complexity is O(m log m + m^2). |
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(m log m + m^2)
to $O(m log m + m^2)$
- The overall time complexity is O(m^3). | ||
|
||
- **Space Complexity**: | ||
- The `dp` table requires O(m^2) space. |
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(m^2)
with $O(m^2)$
|
||
- **Space Complexity**: | ||
- The `dp` table requires O(m^2) space. | ||
- The space complexity is O(m^2). |
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(m^2)
with $O(m^2)$
Made all the mentioned changes |
@ajay-dhangar could you please merge this Pull Request |
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
Fixes #3607 issue
Description
Added Solution to Minimum Cost to Cut a Stick
Type of PR
Screenshots / Videos (if applicable)
[Attach any relevant screenshots or videos demonstrating the changes]
Checklist
Additional Context
[Include any additional information or context that might be helpful for reviewers.]
Resources for Guidance
Please read the following resources before submitting your contribution:
Resources for DSA Features on Our Site:
Contribution Guidelines
Thank you for considering contributing to our project! To ensure smooth collaboration and effective contribution management, please adhere to the following guidelines:
Issue Creation
Contribution Levels
Basic Contributions:
Acknowledging Hard Work:
Feature Additions and Component Work:
Level Definitions
We look forward to your contributions and appreciate your effort in helping us improve the project!