C-Plus-Plus
C-Plus-Plus copied to clipboard
feat: added LeetCode problem 1,2
Created new directory for leetcode solutions, updated DIRECTORY.md and README.md
Description of Change
Checklist
- [x] Added description of change
- [x] Added file name matches File name guidelines
- [x] Added tests and example, test must pass
- [x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
- [x] Relevant documentation/comments is changed or added
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes:
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<ListNode> next; // Use unique_ptr here ... };
Does this directory also fall under doxygen style guidelines?
Does this directory also fall under doxygen style guidelines?
I believe so. Not required, but if added, it's better, IMO.
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
Does this directory also fall under doxygen style guidelines?
I believe so. Not required, but if added, it's better, IMO.
Ah alright!
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.
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.
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!