Skip to content

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

Merged
merged 3 commits into from
Jun 14, 2024
Merged

Added leetcode-216 Combination sum III #1194

merged 3 commits into from
Jun 14, 2024

Conversation

SadafKausar2025
Copy link
Contributor

@SadafKausar2025 SadafKausar2025 commented Jun 14, 2024

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

  • Documentation update

Screenshots / Videos (if applicable)

Screenshot_14-6-2024_12369_localhost

[Attach any relevant screenshots or videos demonstrating the changes]

Checklist

  • I have performed a self-review of my code.
  • I have read and followed the Contribution Guidelines.
  • I have tested the changes thoroughly before submitting this pull request.
  • I have provided relevant issue numbers, screenshots, and videos after making the changes.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have followed the code style guidelines of this project.
  • I have checked for any existing open issues that my pull request may address.
  • I have ensured that my changes do not break any existing functionality.
  • Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently.
  • I have read the resources for guidance listed below.
  • I have followed security best practices in my code changes.

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

  1. Limit on Issues:
    • Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently.

Contribution Levels

  1. Basic Contributions:

    • This project is primarily focused on documentation. Most of the setup has been completed, so contributors will generally need to work on basic code tasks, such as writing tests.
    • For these tasks, issues will be assigned the level1 label.
  2. Acknowledging Hard Work:

    • If a contributor puts in significant effort on a task, the issue will be upgraded to level2. This is our way of recognizing and appreciating extra effort.
  3. Feature Additions and Component Work:

    • Contributors working on new features or components using JSX/TSX will be assigned a level based on the complexity and quality of their work.
    • The more complex and valuable the contribution, the higher the level assigned.

Level Definitions

  • Level1:
    • Tasks are straightforward, such as fixing minor bugs, writing tests, or making simple documentation updates.
  • Level2:
    • Tasks require more effort, such as addressing complex bugs, improving existing features, or making substantial documentation improvements.
  • Level3:
    • Tasks are highly complex and involve significant new feature development, major refactoring, or extensive contributions to the project’s core components.

We look forward to your contributions and appreciate your effort in helping us improve the project!

Copy link
Contributor

deepsource-io bot commented Jun 14, 2024

Here's the code health analysis summary for commits 35e0356..9308c87. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

@github-actions github-actions bot left a 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!

@SadafKausar2025
Copy link
Contributor Author

hello @ajay-dhangar
can you please review this PR and merge it?

@SadafKausar2025
Copy link
Contributor Author

Screenshot (1997)

@SadafKausar2025
Copy link
Contributor Author

hello @ajay-dhangar
please review this PR

@ajay-dhangar ajay-dhangar added documentation Improvements or additions to documentation GSSOC'24 GirlScript Summer of Code | Contributor level1 GirlScript Summer of Code | Contributor's Levels gssoc GirlScript Summer of Code | Contributor labels Jun 14, 2024
@SadafKausar2025
Copy link
Contributor Author

Please also merge it

Copy link
Member

@ajay-dhangar ajay-dhangar left a 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.
Copy link
Member

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.
Copy link
Member

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"/>
Copy link
Member

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

@SadafKausar2025
Copy link
Contributor Author

SadafKausar2025 commented Jun 14, 2024 via email

@SadafKausar2025
Copy link
Contributor Author

hello @ajay-dhangar
I have corrected the changes please merge it

Copy link
Member

@ajay-dhangar ajay-dhangar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ajay-dhangar ajay-dhangar merged commit b396dbe into codeharborhub:main Jun 14, 2024
4 checks passed
@sanjay-kv sanjay-kv removed the level1 GirlScript Summer of Code | Contributor's Levels label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation gssoc GirlScript Summer of Code | Contributor GSSOC'24 GirlScript Summer of Code | Contributor
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Adding 216 leetcode problem (Combination sum III) (Medium)
3 participants