{"id":2118,"date":"2023-10-03T12:01:51","date_gmt":"2023-10-03T04:01:51","guid":{"rendered":"https:\/\/white-night.club\/?p=2118"},"modified":"2023-11-09T11:07:51","modified_gmt":"2023-11-09T03:07:51","slug":"ad24","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/03\/ad24\/","title":{"rendered":"LCR 140.\u00a0\u8bad\u7ec3\u8ba1\u5212 II"},"content":{"rendered":"\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5934\u8282\u70b9\u4e3a&nbsp;<code>head<\/code>&nbsp;\u7684\u94fe\u8868\u7528\u4e8e\u8bb0\u5f55\u4e00\u7cfb\u5217\u6838\u5fc3\u808c\u7fa4\u8bad\u7ec3\u9879\u76ee\u7f16\u53f7\uff0c\u8bf7\u67e5\u627e\u5e76\u8fd4\u56de\u5012\u6570\u7b2c&nbsp;<code>cnt<\/code>&nbsp;\u4e2a\u8bad\u7ec3\u9879\u76ee\u7f16\u53f7\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>head = [2,4,7,8], cnt = 1\n<strong>\u8f93\u51fa\uff1a<\/strong>8<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= head.length &lt;= 100<\/code><\/li>\n\n\n\n<li><code>0 &lt;= head[i] &lt;= 100<\/code><\/li>\n\n\n\n<li><code>1 &lt;= cnt &lt;= head.length<\/code><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u53cc\u6307\u9488<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u56fd\u5e86\u592a\u6478\u9c7c\u4e5f\u4e0d\u597d\uff0c\u6700\u8fd1\u5199\u4e86\u9053\u53cc\u6307\u9488\u7684\u9898\uff0c\u4e0d\u8fc7\u90a3\u9053\u6bd4\u8fd9\u9053\u96be\uff0c\u90a3\u9053\u9898\u8fd8\u8981\u5220\u9664\u8282\u70b9\u3002\u8bf4\u5b9e\u8bdd\u5220\u9664\u8282\u70b9\u6211\u4e00\u76f4\u89c9\u5f97\u5f88\u62bd\u8c61\uff0c\u53ef\u80fdC++\u6307\u9488\u662f\u8fd9\u6837\u7684\u5427\u3002<\/p>\n\n\n\n<p>\u90a3\u5c31\u53cc\u6307\u9488\u5457\uff0c\u55ef&#8230;.\u8c8c\u4f3c\u6ca1\u5565\u80fd\u8bb2\u7684\uff0c\u6709\u70b9\u7b80\u5355\u4e86\u3002\u770b\u5230\u76f8\u5173\u9898\u6709\u4e2a\u5012\u7f6e\u94fe\u8868\u7684\uff0c\u7528\u9012\u5f52\u505a\u4e0b\u770b\u770b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\r\n * Definition for singly-linked list.\r\n * struct ListNode {\r\n *     int val;\r\n *     ListNode *next;\r\n *     ListNode() : val(0), next(nullptr) {}\r\n *     ListNode(int x) : val(x), next(nullptr) {}\r\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\r\n * };\r\n *\/\r\nclass Solution {\r\npublic:\r\n    ListNode* trainingPlan(ListNode* head, int cnt) {\r\n        ListNode*p1=head,*p2=head;\r\n        while(cnt!=0)\r\n        {\r\n            p2=p2->next;\r\n            cnt--;\r\n        }\r\n        while(p2!=NULL)\r\n        {\r\n            p2=p2->next;\r\n            p1=p1->next;\r\n        }\r\n        return p1;\r\n    }\r\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\uff1a\u94fe\u8868\u53cc\u6307\u9488<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2118"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=2118"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2118\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}