{"id":6021,"date":"2024-04-18T00:03:35","date_gmt":"2024-04-17T16:03:35","guid":{"rendered":"http:\/\/zyg.luchers.cn\/?p=6021"},"modified":"2024-04-18T00:03:35","modified_gmt":"2024-04-17T16:03:35","slug":"%e5%93%88%e5%b8%8c%e8%a1%a8%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"http:\/\/zyg.luchers.cn\/index.php\/2024\/04\/18\/%e5%93%88%e5%b8%8c%e8%a1%a8%e5%9f%ba%e7%a1%80\/","title":{"rendered":"\u54c8\u5e0c\u8868\u57fa\u7840"},"content":{"rendered":"<h1>\u54c8\u5e0c\u8868<\/h1>\n<h2>1\u3001\u5185\u5bb9<\/h2>\n<h3>1\u3001\u54c8\u5e0c\u8868<\/h3>\n<p>1\u3001\u54c8\u5e0c\u8868\u5c31\u662f\u6563\u5217\u8868<\/p>\n<p>2\u3001\u4f5c\u7528\uff1a<strong>\u4e00\u822c\u54c8\u5e0c\u8868\u90fd\u662f\u7528\u6765\u5feb\u901f\u5224\u65ad\u4e00\u4e2a\u5143\u7d20\u662f\u5426\u51fa\u73b0\u96c6\u5408\u91cc<\/strong><\/p>\n<h3>2\u3001\u54c8\u5e0c\u51fd\u6570<\/h3>\n<p>1\u3001<\/p>\n<h2>2\u3001\u5f02\u4f4d\u8bcd<\/h2>\n<p>1\u3001\u4ec0\u4e48\u662f\u5f02\u4f4d\u8bcd\uff1a<\/p>\n<h2>3\u3001\u603b\u7ed3<\/h2>\n<h3>1\u3001\u54c8\u5e0c\u51fd\u6570<\/h3>\n<p>1\u3001\u628a\u4f20\u5165\u7684key\u6620\u5c04\u5230\u7b26\u53f7\u8868\u4e0a\u7684\u7d22\u5f15\u4e0a<\/p>\n<h3>2\u3001\u54c8\u5e0c\u78b0\u649e<\/h3>\n<p>1\u3001\u5c31\u662f \u5904\u7406\u591a\u4e2akey\u6620\u5c04\u5230\u76f8\u540c\u7d22\u5f15\u4e0a\u7684\u60c5\u666f\uff0c\u6211\u4eec\u4e00\u822c\u7528\u54c8\u5e0c\u8868+\u94fe\u8868<\/p>\n<h3>3\u3001\u4e09\u79cd\u5e38\u89c1\u7684\u54c8\u5e0c\u7ed3\u6784<\/h3>\n<p>1\u3001\u6570\u7ec4<\/p>\n<p>2\u3001set\uff08\u96c6\u5408\uff09<\/p>\n<p>3\u3001map\uff08\u6620\u5c04\uff09<\/p>\n<h3>4\u3001\u6570\u7ec4\u4f5c\u4e3a\u54c8\u5e0c\u8868<\/h3>\n<h4>1\u3001242\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u91cc\u9762\u5c31\u662f\u7528\u5230\u6570\u7ec4\u4f5c\u4e3a\u54c8\u5e0c\u8868<\/p>\n<p>2\u3001\u7528ASIC\u7801\u503c\u6765\u4f5c\u4e3a\u6570\u7ec4\u503c\uff0c\u6bcf\u4e2a\u5b57\u6bcd\u4f5c\u4e3a\u6570\u7ec4\u7d22\u5f15<\/p>\n<p>3\u3001\u7136\u540e\u904d\u5386\uff0c\u662f\u5426\u51fa\u73b0\uff0c\u51fa\u73b0\u5c31\u628a\u6570\u7ec4\u503c+1\uff0c\u6700\u540e\u5224\u65ad\u6570\u7ec4\u662f\u5426\u4e3a0\uff0c==0\u5c31\u8bf4\u660e\u6ca1\u6709\u91cd\u590d\u7684\uff0c!=0\u5c31\u662f\u6709\u91cd\u590d\u7684<\/p>\n<p>4\u3001\u7edf\u8ba1\u5199\u6cd5<\/p>\n<pre><code>for(int i =0;i&lt;s.length();i++){\n            recrud[s.charAt(i) - &#039;a&#039;]++;\n        }<\/code><\/pre>\n<h4>2\u3001383\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u4e5f\u662f\u540c\u7406<\/p>\n<h3>5\u3001set\u4f5c\u4e3a\u54c8\u5e0c\u8868<\/h3>\n<h4>1\u3001349\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u6ca1\u6709\u7ed9\u51fa\u4efb\u4f55\u957f\u5ea6\u9650\u5236\uff0c\u5c31\u6ca1\u529e\u6cd5\u7528\u6570\u7ec4\uff0c\u53ea\u80fd\u7528set\u4e86<\/p>\n<p>2\u3001\u5982\u679c\u7528\u6570\u7ec4\u5c31\u4f1a\u51fa\u73b0\u7a7a\u95f4\u6d6a\u8d39\u6216\u811a\u6807\u8d8a\u754c<\/p>\n<p>3\u3001\u76f4\u63a5\u5229\u7528set\u7684\u7279\u6027\uff0c\u5c31\u662f\u4e0d\u80fd\u6dfb\u52a0\u91cd\u590d\u7684\u6570\u636e\uff08\u5176\u4e2d\u8ddf\u54c8\u5e0c\u503c\u76f8\u5173\uff09<\/p>\n<h4>2\u3001202\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u4e5f\u662f\u4e00\u6837\u7684\u601d\u8def<\/p>\n<h3>6\u3001map\u4f5c\u4e3a\u54c8\u5e0c\u8868<\/h3>\n<p>1\u3001\u5229\u7528map\u7684key-value\u7684\u7ed3\u6784<\/p>\n<h4>1\u30011\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u56e0\u4e3a\u6ca1\u6709\u8981\u6c42key\u662f\u5426\u6709\u5e8f\uff0c\u6240\u4ee5\u7528map\u6548\u7387\u9ad8<\/p>\n<h4>2\u300115\u300118\u30011\u529b\u6263\u9898<\/h4>\n<p>1\u3001\u8fd9\u4e09\u4e2a\u9898\u90fd\u662f\u5229\u7528map\u7684key-value\u5c5e\u6027<\/p>\n<p>2\u3001\u4f46\u662f\u8fd9\u91cc\u6700\u91cd\u8981\u7684\u662f\u53bb\u91cd\uff01<\/p>\n<p>3\u3001\u8fd8\u8981\u7ed3\u5408\u53cc\u6307\u9488\u8fdb\u884c\u64cd\u4f5c\uff0c\u80fd\u63d0\u9ad8\u6548\u7387<\/p>\n<p>4\u3001\u63a8\u8350\u4f7f\u7528\u53cc\u6307\u9488\u7ed3\u5408<\/p>\n<h5>1\u300115\u53bb\u91cd<\/h5>\n<p>1\u3001\u6c423\u4e2a\u6570a,b,c\u76f8\u52a0=0\uff0c\u8fd9\u91cc\u6211\u4eec\u5148\u6392\u5e8f\uff08\u4e3a\u53cc\u6307\u9488\u505a\u51c6\u5907\uff09<\/p>\n<p>2\u3001\u7136\u540e\u5bf9a\u53bb\u91cd\uff0c\u8fd9\u91cc\u91cd\u70b9\u662f\u8fd9\u4e2a<\/p>\n<pre><code>if(nums[i] ==nums[i-1]){\n    continue;\n}\nnums[i] ==nums[i-1]\u5224\u65ad\u7684\u662fa\u662f\u5426\u6709\u91cd\u590d\u7684\u503c\nnums[i] ==nums[i+1]\u5224\u65ad\u7684\u662fa\u548cb\u662f\u5426\u91cd\u590d\uff0c\u5c31\u662f\u4e00\u4e2a\u7ed3\u679c\u96c6\u662f\u5426\u6709\u91cd\u590d\uff0c\u4e0e\u9898\u610f\u4e0d\u7b26\n<\/code><\/pre>\n<p>3\u3001 <strong>\u4e0d\u80fd\u6709\u91cd\u590d\u7684\u4e09\u5143\u7ec4\uff0c\u4f46\u4e09\u5143\u7ec4\u5185\u7684\u5143\u7d20\u662f\u53ef\u4ee5\u91cd\u590d\u7684\uff01<\/strong><\/p>\n<p>4\u3001\u4e3e\u4f8b\uff1a<\/p>\n<pre><code>\u8fd9\u4e48\u5199\u5c31\u662f\u5f53\u524d\u4f7f\u7528 nums[i]\uff0c\u6211\u4eec\u5224\u65ad\u524d\u4e00\u4f4d\u662f\u4e0d\u662f\u4e00\u6837\u7684\u5143\u7d20\uff0c\u5728\u770b {-1, -1 ,2} \u8fd9\u7ec4\u6570\u636e\uff0c\u5f53\u904d\u5386\u5230 \u7b2c\u4e00\u4e2a -1 \u7684\u65f6\u5019\uff0c\u53ea\u8981\u524d\u4e00\u4f4d\u6ca1\u6709-1\uff0c\u90a3\u4e48 {-1, -1 ,2} \u8fd9\u7ec4\u6570\u636e\u4e00\u6837\u53ef\u4ee5\u6536\u5f55\u5230 \u7ed3\u679c\u96c6\u91cc\u3002<\/code><\/pre>\n<p>5\u3001\u5bf9b,c\u53bb\u91cd\uff0c\u91cd\u70b9\u662f\u8fd9\u4e2a<\/p>\n<pre><code>result.add(Arrays.asList(nums[i], nums[left], nums[right]));\n            \/\/ \u53bb\u91cd\u903b\u8f91\u5e94\u8be5\u653e\u5728\u627e\u5230\u4e00\u4e2a\u4e09\u5143\u7ec4\u4e4b\u540e\uff0c\u5bf9b \u548c c\u53bb\u91cd\n                    while (right &gt; left &amp;&amp; nums[right] == nums[right - 1]) right--;\n                    while (right &gt; left &amp;&amp; nums[left] == nums[left + 1]) left++;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u54c8\u5e0c\u8868 1\u3001\u5185\u5bb9 1\u3001\u54c8\u5e0c\u8868 1\u3001\u54c8\u5e0c\u8868\u5c31\u662f\u6563\u5217\u8868 2\u3001\u4f5c\u7528\uff1a\u4e00\u822c\u54c8\u5e0c\u8868\u90fd\u662f\u7528\u6765\u5feb\u901f\u5224\u65ad\u4e00\u4e2a\u5143\u7d20\u662f\u5426\u51fa\u73b0\u96c6\u5408\u91cc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-6021","post","type-post","status-publish","format-standard","hentry","category-27"],"_links":{"self":[{"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/posts\/6021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/comments?post=6021"}],"version-history":[{"count":1,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/posts\/6021\/revisions"}],"predecessor-version":[{"id":6022,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/posts\/6021\/revisions\/6022"}],"wp:attachment":[{"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/media?parent=6021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/categories?post=6021"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zyg.luchers.cn\/index.php\/wp-json\/wp\/v2\/tags?post=6021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}