<
8000
script type="application/json" data-target="react-app.embeddedData">{"payload":{"commit":{"oid":"01a56f61ead5004b61b3686df5d50b82098d6bcf","url":"/TylerzhangZC/leetcode/commit/01a56f61ead5004b61b3686df5d50b82098d6bcf","authoredDate":"2014-01-06T21:39:40.000-08:00","committedDate":"2014-01-06T21:39:40.000-08:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eMerge pull request \u003ca class=\"issue-link js-issue-link\" data-error-text=\"Failed to load title\" data-id=\"25069019\" data-permission-text=\"Title is private\" data-url=\"https://github.com/soulmachine/leetcode/issues/11\" data-hovercard-type=\"pull_request\" data-hovercard-url=\"/soulmachine/leetcode/pull/11/hovercard\" href=\"https://github.com/soulmachine/leetcode/pull/11\"\u003esoulmachine#11\u003c/a\u003e from advancedxy/master\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"change variable name h to dummy to follow name convention","authors":[{"login":"soulmachine","displayName":"Frank Dai","avatarUrl":"https://avatars.githubusercontent.com/u/620768?v=4","path":"/soulmachine","isGitHub":false}],"committerAttribution":false,"committer":{"login":"soulmachine","displayName":"Frank Dai","avatarUrl":"https://avatars.githubusercontent.com/u/620768?v=4","path":"/soulmachine","isGitHub":false},"parents":["c4f6258881c38744fcb14fae68f02bdeb6531763","c6a7e96beb2f0b0340268c74baa5e54116e06d98"],"globalRelayId":"MDY6Q29tbWl0MzIyNTAzNjg6MDFhNTZmNjFlYWQ1MDA0YjYxYjM2ODZkZjVkNTBiODIwOThkNmJjZg==","sha1":"c4f6258881c38744fcb14fae68f02bdeb6531763","sha2":"01a56f61ead5004b61b3686df5d50b82098d6bcf"},"currentUser":null,"repo":{"id":32250368,"defaultBranch":"master","name":"leetcode","ownerLogin":"TylerzhangZC","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2015-03-15T07:57:21.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/5627214?v=4","public":true,"private":false,"isOrgOwned":false},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":61,"text":"@@ -62,14 +62,14 @@ \\subsubsection{代码}","html":"@@ -62,14 +62,14 @@ \\subsubsection{代码}","displayNoNewLineWarning":false,"position":0,"left":61,"right":61},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":62,"text":" ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {","html":" ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {","displayNoNewLineWarning":false,"position":1,"left":62,"right":62},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":63,"text":" if (l1 == nullptr) return l2;","html":" if (l1 == nullptr) return l2;","displayNoNewLineWarning":false,"position":2,"left":63,"right":63},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":64,"text":" if (l2 == nullptr) return l1;","html":" if (l2 == nullptr) return l1;","displayNoNewLineWarning":false,"position":3,"left":64,"right":64},{"stylingDirective":null,"type":"DELETION","blobLineNumber":65,"text":"- ListNode h(-1);","html":"- ListNode \u003cspan class=\"x x-first x-last\"\u003eh\u003c/span\u003e(-1);","displayNoNewLineWarning":false,"position":4,"left":65,"right":64},{"stylingDirective":null,"type":"DELETION","blobLineNumber":66,"text":"- ListNode *p = \u0026h;","html":"- ListNode *p = \u0026amp;\u003cspan class=\"x x-first x-last\"\u003eh\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":66,"right":64},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":65,"text":"+ ListNode dummy(-1);","html":"+ ListNode \u003cspan class=\"x x-first x-last\"\u003edummy\u003c/span\u003e(-1);","displayNoNewLineWarning":false,"position":6,"left":66,"right":65},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":66,"text":"+ ListNode *p = \u0026dummy;","html":"+ ListNode *p = \u0026amp;\u003cspan class=\"x x-first x-last\"\u003edummy\u003c/span\u003e;","displayNoNewLineWarning":false,"position":7,"left":66,"right":66},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":67,"text":" for (; l1 != nullptr \u0026\u0026 l2 != nullptr; p = p-\u003enext) {","html":" for (; l1 != nullptr \u0026amp;\u0026amp; l2 != nullptr; p = p-\u0026gt;next) {","displayNoNewLineWarning":false,"position":8,"left":67,"right":67},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":68,"text":" if (l1-\u003eval \u003e l2-\u003eval) { p-\u003enext = l2; l2 = l2-\u003enext; }","html":" if (l1-\u0026gt;val \u0026gt; l2-\u0026gt;val) { p-\u0026gt;next = l2; l2 = l2-\u0026gt;next; }","displayNoNewLineWarning":false,"position":9,"left":68,"right":68},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":69,"text":" else { p-\u003enext = l1; l1 = l1-\u003enext; }","html":" else { p-\u0026gt;next = l1; l1 = l1-\u0026gt;next; }","displayNoNewLineWarning":false,"position":10,"left":69,"right":69},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":70,"text":" }","html":" }","displayNoNewLineWarning":false,"position":11,"left":70,"right":70},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":71,"text":" p-\u003enext = l1 != nullptr ? l1 : l2;","html":" p-\u0026gt;next = l1 != nullptr ? l1 : l2;","displayNoNewLineWarning":false,"position":12,"left":71,"right":71},{"stylingDirective":null,"type":"DELETION","blobLineNumber":72,"text":"- return h.next;","html":"- return \u003cspan class=\"x x-first x-last\"\u003eh\u003c/span\u003e.next;","displayNoNewLineWarning":false,"position":13,"left":72,"right":71},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":72,"text":"+ return dummy.next;","html":"+ return \u003cspan class=\"x x-first x-last\"\u003edummy\u003c/span\u003e.next;","displayNoNewLineWarning":false,"position":14,"left":72,"right":72},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":73,"text":" }","html":" }","displayNoNewLineWarning":false,"position":15,"left":73,"right":73},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":74,"text":" };","html":" };","displayNoNewLineWarning":false,"position":16,"left":74,"right":74},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":75,"text":" \\end{Code}","html":" \u003cspan class=\"pl-c1\"\u003e\\end\u003c/span\u003e{\u003cspan class=\"pl-smi\"\u003eCode\u003c/span\u003e}","displayNoNewLineWarning":false,"position":17,"left":75,"right":75}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":423,"linesChanged":6,"newTreeEntry":{"lineCount":423,"path":"C++/chapSorting.tex","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"C++/chapSorting.tex","mode":100644},"linesAdded":3,"linesDeleted":3,"path":"C++/chapSorting.tex","pathDigest":"d823c26bb1922b1c450cec907c727b252b17e2a23aa039bd9dd18278117b3690","status":"MODIFIED","truncatedReason":null,"oldOid":"c4f6258881c38744fcb14fae68f02bdeb6531763","newOid":"01a56f61ead5004b61b3686df5d50b82098d6bcf","copilotChatReference":null,"deletedSha":"c4f6258881c38744fcb14fae68f02bdeb6531763","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/TylerzhangZC/leetcode/commit/01a56f61ead5004b61b3686df5d50b82098d6bcf","fileTreeExpanded":true,"headerInfo":{"additions":3,"deletions":3,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":604,"lineShownCount":18},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"Xpen4Hj-AB_4cpGN82wu1FTx9hwgOvhk3NEOLjz6AK_ykkMmAtYiflZmz1C1jkslAeLqj82gncZPT5wfcSmVKA"},"/users/diffview?diff=unified":{"post":"R-X9Xi4SKY84-AsuDxREmIc37opk_tKRhbiGTZRJ0AHr4BmYVDoL7pbsVfNJ9iFp0iTyGYlktzMWJhR82ZpFhg"},"/notifications/thread":{"post":"tPZqpBvp8IaBa96gB8kXS-YeigNH4CTxkPmKrzMTPR746Zq7kYFKIexr0zhyi_bmBGTBjau9ffnqRKpUvygFeg"}}},"title":"Merge pull request #11 from advancedxy/master · TylerzhangZC/leetcode@01a56f6","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-f6b2312e7da9.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":false,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false}}}
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,14 @@ \subsubsection{代码}
62
62
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
63
63
if (l1 == nullptr) return l2;
64
64
if (l2 == nullptr) return l1;
65
- ListNode h (-1);
66
- ListNode *p = &h ;
65
+ ListNode dummy (-1);
66
+ ListNode *p = &dummy ;
67
67
for (; l1 != nullptr && l2 != nullptr; p = p->next) {
68
68
if (l1->val > l2->val) { p->next = l2; l2 = l2->next; }
69
69
else { p->next = l1; l1 = l1->next; }
70
70
}
71
71
p->next = l1 != nullptr ? l1 : l2;
72
- return h .next;
72
+ return dummy .next;
73
73
}
74
74
};
75
75
\end {Code }
You can’t perform that action at this time.
0 commit comments