-
-
Notifications
You must be signed in to change notification settings - Fork 155
Added leetcode-216 Combination sum III #1194
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
Added leetcode-216 Combination sum III #1194
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, @SadafKausar2025! 🎉 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!
hello @ajay-dhangar |
hello @ajay-dhangar |
Please also merge it |
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. If you would like to make any changes, please use your name as the author of the solution. If you are not interested, I will merge it after some time based on your response.
@@ -217,6 +217,12 @@ Example 3: | |||
|
|||
</Tabs> | |||
|
|||
## Time and Space Complexity | |||
|
|||
The time complexity of the code is O(n), where n is the length of the input list nums. This is because there are two pointers i and j, both of which travel across the list at most once. The inner while loop only increases j and decreases the sum s until the sum is less than the target, but j can never be increased more than n times throughout the execution of the algorithm. Therefore, each element is processed at most twice, once when it is added to s and once when it is subtracted, leading to a linear time complexity. |
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)
to $O(n)$
|
||
The time complexity of the code is O(n), where n is the length of the input list nums. This is because there are two pointers i and j, both of which travel across the list at most once. The inner while loop only increases j and decreases the sum s until the sum is less than the target, but j can never be increased more than n times throughout the execution of the algorithm. Therefore, each element is processed at most twice, once when it is added to s and once when it is subtracted, leading to a linear time complexity. | ||
|
||
The space complexity of the code is O(1), which means it requires a constant amount of additional space. This is because the algorithm only uses a fixed number of single-value variables (n, ans, s, j, i, x) and does not utilize any data structures that grow with the size of the input. |
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(1)
to $O(1)$
``` | ||
</TabItem> | ||
<TabItem value="java" label="Java"> | ||
<SolutionAuthor name="@Ajay-Dhangar"/> |
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 name="@Ajay-Dhangar"
to YOUR_GITHUG_USER_NAME
optional for you
Your name looks good it,s fine
…On Fri, 14 Jun, 2024, 2:16 pm Ajay Dhangar, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Done. If you would like to make any changes, please use your name as the
author of the solution. If you are not interested, I will merge it after
some time based on your response.
------------------------------
In dsa-solutions/lc-solutions/0200-0299/0209-minimum-size-subarray-sum.md
<#1194 (comment)>
:
> @@ -217,6 +217,12 @@ Example 3:
</Tabs>
+## Time and Space Complexity
+
+ The time complexity of the code is O(n), where n is the length of the input list nums. This is because there are two pointers i and j, both of which travel across the list at most once. The inner while loop only increases j and decreases the sum s until the sum is less than the target, but j can never be increased more than n times throughout the execution of the algorithm. Therefore, each element is processed at most twice, once when it is added to s and once when it is subtracted, leading to a linear time complexity.
replace O(n) to $O(n)$
------------------------------
In dsa-solutions/lc-solutions/0200-0299/0209-minimum-size-subarray-sum.md
<#1194 (comment)>
:
> @@ -217,6 +217,12 @@ Example 3:
</Tabs>
+## Time and Space Complexity
+
+ The time complexity of the code is O(n), where n is the length of the input list nums. This is because there are two pointers i and j, both of which travel across the list at most once. The inner while loop only increases j and decreases the sum s until the sum is less than the target, but j can never be increased more than n times throughout the execution of the algorithm. Therefore, each element is processed at most twice, once when it is added to s and once when it is subtracted, leading to a linear time complexity.
+
+ The space complexity of the code is O(1), which means it requires a constant amount of additional space. This is because the algorithm only uses a fixed number of single-value variables (n, ans, s, j, i, x) and does not utilize any data structures that grow with the size of the input.
replace O(1) to $O(1)$
------------------------------
In dsa-solutions/lc-solutions/0200-0299/0216-Combination-sum-III.md
<#1194 (comment)>
:
> +
+ auto result = combination(nums, i + 1, target - nums[i], length, currentSeq, output);
+
+ currentSeq.pop_back();
+
+ if (!result) {
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+ ```
+ </TabItem>
+ <TabItem value="java" label="Java">
+ <SolutionAuthor ***@***.***"/>
replace ***@***.***" to YOUR_GITHUG_USER_NAME optional for you
—
Reply to this email directly, view it on GitHub
<#1194 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BAY5VHS3TFEXKGKGLYPUEATZHKUV5AVCNFSM6AAAAABJJY2OZOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMJXHAZTIMRWGM>
.
You are receiving this because you were assigned.Message ID:
***@***.***
com>
|
hello @ajay-dhangar |
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
Fix #1139
[Cite any related issue(s) this pull request addresses. If none, simply state "None”]
Description
[Please include a brief description of the changes or features added]
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!