Skip to content

feat: add solutions to lc problem: No.0147 #4437

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 1 commit into from
May 27, 2025
Merged

Conversation

taoyq1988
Copy link
Member

No.0147.Insertion Sort List

@taoyq1988 taoyq1988 requested a review from Copilot May 26, 2025 13:02
@idoocs idoocs added go Issues or Pull requests relate to .go code core team Issues or pull requests from core team md Issues or Pull requests relate to .md files labels May 26, 2025
@taoyq1988 taoyq1988 requested a review from yanglbme May 26, 2025 13:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a Go solution for LeetCode problem No.0147 (Insertion Sort List) and updates the language-agnostic READMEs to include the new Go implementation.

  • Introduced insertionSortList in Go under the problem folder.
  • Added Go code snippets to both README_EN.md and README.md.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
solution/0100-0199/0147.Insertion Sort List/Solution.go New Go implementation of insertionSortList.
solution/0100-0199/0147.Insertion Sort List/README_EN.md Added Go code example.
solution/0100-0199/0147.Insertion Sort List/README.md Added Go code example.
Comments suppressed due to low confidence (4)

solution/0100-0199/0147.Insertion Sort List/Solution.go:13

  • [nitpick] The variable name pre is ambiguous. Consider renaming it to something like lastSorted or sortedTail to clarify its role.
pre, cur := dummy, head

solution/0100-0199/0147.Insertion Sort List/Solution.go:20

  • [nitpick] The loop pointer p could be renamed to insertPos or prevNode for clearer intent.
p := dummy

solution/0100-0199/0147.Insertion Sort List/Solution.go:24

  • [nitpick] The temporary variable t is non-descriptive. Consider renaming it to nextUnsorted or nextTemp.
t := cur.Next

solution/0100-0199/0147.Insertion Sort List/Solution.go:8

  • There are no accompanying unit tests for this function. Please add tests covering edge cases such as an empty list, single-node list, reversed list, and lists with duplicate values.
func insertionSortList(head *ListNode) *ListNode {

No.0147.Insertion Sort List
@yanglbme yanglbme merged commit ce35926 into doocs:main May 27, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Issues or pull requests from core team go Issues or Pull requests relate to .go code md Issues or Pull requests relate to .md files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants