{"id":145,"date":"2020-04-27T15:57:53","date_gmt":"2020-04-27T19:57:53","guid":{"rendered":"https:\/\/hanaki.cc\/?p=145"},"modified":"2020-04-27T17:26:18","modified_gmt":"2020-04-27T21:26:18","slug":"169-majority-element","status":"publish","type":"post","link":"https:\/\/kiyoguan.cc\/?p=145","title":{"rendered":"169.majority-element"},"content":{"rendered":"\n<p>\u539f\u59cb\u601d\u8def\uff1a\u5b57\u5178<\/p>\n\n\n\n<p>\u53c2\u8003\u7b54\u6848\u601d\u8def\uff1a\u6295\u7968\u7b97\u6cd5<\/p>\n\n\n\n<p>\u80cc\u540e\u539f\u7406\u7b80\u5355\u7684\u7406\u89e3\u662f \u5982\u679c\u4f60\u8981\u5f53\u9009\uff0c\u652f\u6301\u4f60\u7684\u4eba\u81f3\u5c11\u8981\u8d85\u8fc7\u534a\u6570<\/p>\n\n\n\n<p>\u548c\u9898\u76ee\u7684\u5b9a\u4e49\uff1aThe majority element is the element that appears more than \u230a n\/2 \u230b times \u4e00\u81f4<\/p>\n\n\n\n<p>\u6211\u7684\u540e\u7eed\u601d\u8def\uff1a\u505a\u4e00\u4e2a\u6808\uff0c\u5982\u679c\u8bfb\u5230\u7684\u6570\u5b57\u548c\u6808\u9876\u7684\u6570\u5b57\u4e0d\u4e00\u6837\uff0c\u610f\u601d\u662f\u8fd9\u4e2a\u4eba\u662f\u4e2a\u53cd\u5bf9\u515a\u7684\uff0c\u7136\u540e\u6808\u9876\u6570\u5b57\u51fa\u5217\uff0c\u4ee3\u8868\u4ed6\u4eec\u4e24\u4e2a\u62b5\u6d88\u4e86\uff1b\u5982\u679c\u8bfb\u5230\u7684\u6570\u5b57\u548c\u6808\u9876\u6570\u5b57\u4e00\u6837\uff0c\u5165\u6808\uff0c\u4ee3\u8868\u76f8\u540c\u52bf\u529b<\/p>\n\n\n\n<p>\u6700\u540e\u8fd8\u5728\u6808\u91cc\u7684\u4eba\u5c31\u662f\u7b54\u6848<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u53c2\u8003\u7b54\u6848\u7684\u89e3\u51b3\u65b9\u6848\u6ca1\u7528\u6808\uff0c\u76f4\u63a5\u6bd4\u8f83\n\u7528\u4e86\u4e24\u4e2a\u53c2\u6570\uff0c\u4e00\u4e2a\u662f\u52bf\u529b\u6570\uff0c\u53e6\u4e00\u4e2a\u662f\u5019\u9009\u4eba\n\u5982\u679c\u8bfb\u5230\u7684\u6570\u5b57\u548c\u5019\u9009\u4eba\u4e00\u4e2a\u52bf\u529b\uff0c\u52bf\u529b\u6570+1\n\u5426\u5219\u52bf\u529b\u6570\u51cf1\n\u5982\u679c\u52bf\u529b\u6570\u4e3a0\uff0c\u4ee3\u8868\u6ca1\u6709\u5019\u9009\u4eba\u90fdgg\u4e86\uff0c\u6700\u65b0\u8bfb\u5230\u7684\u6570\u5c31\u53d8\u6210\u5019\u9009\u4eba<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u59cb\u601d\u8def\uff1a\u5b57\u5178 \u53c2\u8003\u7b54\u6848\u601d\u8def\uff1a\u6295\u7968\u7b97\u6cd5 \u80cc\u540e\u539f\u7406\u7b80\u5355\u7684\u7406\u89e3\u662f \u5982\u679c\u4f60\u8981\u5f53\u9009\uff0c\u652f\u6301\u4f60\u7684\u4eba\u81f3\u5c11\u8981\u8d85\u8fc7\u534a\u6570 \u548c\u9898\u76ee\u7684\u5b9a\u4e49\uff1aThe majority element is the element that appears more than \u230a n\/2 \u230b times \u4e00\u81f4 \u6211\u7684\u540e\u7eed\u601d\u8def\uff1a\u505a\u4e00\u4e2a\u6808\uff0c\u5982\u679c\u8bfb\u5230\u7684\u6570\u5b57\u548c\u6808\u9876\u7684\u6570\u5b57\u4e0d\u4e00\u6837\uff0c\u610f\u601d\u662f\u8fd9\u4e2a\u4eba\u662f\u4e2a\u53cd\u5bf9\u515a\u7684\uff0c\u7136\u540e\u6808\u9876\u6570\u5b57\u51fa\u5217\uff0c\u4ee3\u8868\u4ed6\u4eec\u4e24\u4e2a\u62b5\u6d88\u4e86\uff1b\u5982\u679c\u8bfb\u5230\u7684\u6570\u5b57\u548c\u6808\u9876\u6570\u5b57\u4e00\u6837\uff0c\u5165\u6808\uff0c\u4ee3\u8868\u76f8\u540c\u52bf\u529b \u6700\u540e\u8fd8\u5728\u6808\u91cc\u7684\u4eba\u5c31\u662f\u7b54\u6848<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-145","post","type-post","status-publish","format-standard","hentry","category-leetcode"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/posts\/145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=145"}],"version-history":[{"count":4,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions\/150"}],"wp:attachment":[{"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kiyoguan.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}