Skip to content
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

feat: added LeetCode problem 1,2 #2450

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

nageshnnazare
Copy link

@nageshnnazare nageshnnazare commented Apr 14, 2023

Created new directory for leetcode solutions, updated DIRECTORY.md and README.md

Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

Created new directory for leetcode solutions
@nageshnnazare nageshnnazare marked this pull request as draft April 14, 2023 14:02
@nageshnnazare nageshnnazare marked this pull request as ready for review April 14, 2023 14:02
@Panquesito7 Panquesito7 added the enhancement New feature or request label Apr 14, 2023
leetcode/src/1.cpp Outdated Show resolved Hide resolved
leetcode/src/2.cpp Outdated Show resolved Hide resolved
leetcode/DIRECTORY.md Outdated Show resolved Hide resolved
@nageshnnazare nageshnnazare marked this pull request as draft April 14, 2023 19:12
@nageshnnazare nageshnnazare marked this pull request as ready for review April 14, 2023 19:19
- name: Write LeetCode DIRECTORY.md
run: |
python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md
git pull || true
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, this is not needed if we use fetch-depth in actions/checkout.
CC: @tjgurwara99.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this is not needed.

scripts/leetcode_directory_md.py Outdated Show resolved Hide resolved
leetcode/README.md Outdated Show resolved Hide resolved
@nageshnnazare nageshnnazare marked this pull request as draft April 15, 2023 06:06
@nageshnnazare nageshnnazare marked this pull request as ready for review April 15, 2023 06:15
@nageshnnazare
Copy link
Author

nageshnnazare commented Apr 16, 2023

Hi @Panquesito7, @tjgurwara99
For problem 2, the CI is failing with the following warnings:

/home/runner/work/C-Plus-Plus/C-Plus-Plus/leetcode/src/2.cpp:29:9: warning: assigning newly created 'gsl::owner<>' to non-owner 'ListNode *' [cppcoreguidelines-owning-memory]
sum->next = new ListNode(val%10);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/C-Plus-Plus/C-Plus-Plus/leetcode/src/2.cpp:35:9: warning: assigning newly created 'gsl::owner<>' to non-owner 'ListNode *' [cppcoreguidelines-owning-memory]
sum->next = new ListNode(carry);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I guess it is because of the use of raw pointers instead of smart pointers. Is there a way to suppress this?

(This may require changing the definition of the ListNode struct, which is already defined by the platform)

struct ListNode {
int val;
std::unique_ptr next; // Use unique_ptr here
...
};

@realstealthninja
Copy link
Collaborator

Does this directory also fall under doxygen style guidelines?

@Panquesito7
Copy link
Member

Does this directory also fall under doxygen style guidelines?

I believe so. Not required, but if added, it's better, IMO.

@Panquesito7
Copy link
Member

Panquesito7 commented Apr 26, 2023

Is there a way to suppress this?

It'd be better to use smart pointers, though.
I found this to convert raw to a smart pointer, it may help: https://www.sololearn.com/Discuss/1958592/how-can-i-replace-raw-pointers-with-smart-pointers

@realstealthninja
Copy link
Collaborator

Does this directory also fall under doxygen style guidelines?

I believe so. Not required, but if added, it's better, IMO.

Ah alright!

@github-actions
Copy link
Contributor

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label May 27, 2023
@Panquesito7 Panquesito7 removed the stale Author has not responded to the comments for over 2 weeks label May 30, 2023
@github-actions
Copy link
Contributor

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Jun 30, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

@github-actions github-actions bot closed this Jul 7, 2023
@Panquesito7 Panquesito7 reopened this Jul 7, 2023
@Panquesito7 Panquesito7 added dont-close This issue/pull request shouldn't be closed and removed stale Author has not responded to the comments for over 2 weeks labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dont-close This issue/pull request shouldn't be closed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants