{"id":2588,"date":"2023-10-14T16:51:36","date_gmt":"2023-10-14T08:51:36","guid":{"rendered":"https:\/\/white-night.club\/?p=2588"},"modified":"2023-11-09T11:07:49","modified_gmt":"2023-11-09T03:07:49","slug":"ad53","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/14\/ad53\/","title":{"rendered":"136.\u00a0\u53ea\u51fa\u73b0\u4e00\u6b21\u7684\u6570\u5b57"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e00\u4e2a\u00a0<strong>\u975e\u7a7a<\/strong>\u00a0\u6574\u6570\u6570\u7ec4\u00a0<code>nums<\/code>\u00a0\uff0c\u9664\u4e86\u67d0\u4e2a\u5143\u7d20\u53ea\u51fa\u73b0\u4e00\u6b21\u4ee5\u5916\uff0c\u5176\u4f59\u6bcf\u4e2a\u5143\u7d20\u5747\u51fa\u73b0\u4e24\u6b21\u3002\u627e\u51fa\u90a3\u4e2a\u53ea\u51fa\u73b0\u4e86\u4e00\u6b21\u7684\u5143\u7d20\u3002<\/p>\n\n\n\n<p>\u4f60\u5fc5\u987b\u8bbe\u8ba1\u5e76\u5b9e\u73b0\u7ebf\u6027\u65f6\u95f4\u590d\u6742\u5ea6\u7684\u7b97\u6cd5\u6765\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u4e14\u8be5\u7b97\u6cd5\u53ea\u4f7f\u7528\u5e38\u91cf\u989d\u5916\u7a7a\u95f4\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>nums = [2,2,1]\n<strong>\u8f93\u51fa\uff1a<\/strong>1\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2 \uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>nums = [4,1,2,1,2]\n<strong>\u8f93\u51fa\uff1a<\/strong>4\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 3 \uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>nums = [1]\n<strong>\u8f93\u51fa\uff1a<\/strong>1\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= nums.length &lt;= 3 * 10<sup>4<\/sup><\/code><\/li>\n\n\n\n<li><code>-3 * 10<sup>4<\/sup> &lt;= nums[i] &lt;= 3 * 10<sup>4<\/sup><\/code><\/li>\n\n\n\n<li>\u9664\u4e86\u67d0\u4e2a\u5143\u7d20\u53ea\u51fa\u73b0\u4e00\u6b21\u4ee5\u5916\uff0c\u5176\u4f59\u6bcf\u4e2a\u5143\u7d20\u5747\u51fa\u73b0\u4e24\u6b21\u3002<\/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>\u5f02\u6216\u8fd0\u7b97\u7b26<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5f02\u6216\uff1a\u4e8c\u8fdb\u5236\u76f8\u540c\u4f4d\u53d60\uff0c\u4e0d\u540c\u4f4d\u53d61\u3002<\/p>\n\n\n\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0cA=1(0001)\uff0cB=2(0010)\uff0cC=1(0001)\uff0cD=3(0011)\u56db\u4e2a\u6570\u3002<\/p>\n\n\n\n<ul>\n<li>A^C=0(0000)<\/li>\n\n\n\n<li>A^B=3(0011)<\/li>\n\n\n\n<li>A^D=2(0010)<\/li>\n\n\n\n<li>A^B^C=2(0010)<\/li>\n\n\n\n<li>A^C^D=3(0011)<\/li>\n<\/ul>\n\n\n\n<p>\u5982\u679c\u4e24\u4e2a\u76f8\u540c\u7684\u6570\u5f02\u6216\uff0c\u90a3\u4e48\u7ed3\u679c\u4e3a0\u3002\u800c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">0\u548c\u5176\u4ed6\u6570\u5f02\u6216\u4e0d\u4f1a\u6539\u53d8\u5176\u4ed6\u6570\u7684\u7ed3<\/mark>\u679c\u3002<\/p>\n\n\n\n<p>\u8fd9\u9898\u91cd\u590d\u7684\u6570\u636e\u90fd\u53ea\u51fa\u73b0\u4e86\u4e24\u6b21\uff0c\u90a3\u76f4\u63a5\u5f02\u6216\u5c31\u80fd\u53bb\u6389\u6240\u6709\u51fa\u73b0\u4e86\u4e24\u6b21\u7684\u6570\uff0c\u6700\u540e\u5269\u4e0b\u7684\u5c31\u662f\u6211\u4eec\u8981\u627e\u7684\u53ea\u51fa\u73b0\u4e86\u4e00\u6b21\u7684\u6570\u5b57\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\r\npublic:\r\n    int singleNumber(vector&lt;int>&amp; nums) {\r\n        int size=nums.size();\r\n        int num=0;\r\n        for(int i=0;i&lt;size;i++)\r\n        {\r\n            num^=nums&#91;i];\r\n        }\r\n        return num;\r\n    }\r\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u5f02\u6216\u8fd0\u7b97<\/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\/2588"}],"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=2588"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2588\/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=2588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}