{"id":2300,"date":"2016-10-23T00:38:02","date_gmt":"2016-10-22T16:38:02","guid":{"rendered":"http:\/\/boweihe.me\/?p=2300"},"modified":"2016-10-23T00:38:02","modified_gmt":"2016-10-22T16:38:02","slug":"indeed-tokyo-%e7%ac%94%e8%af%95%e9%a2%98%e4%b8%80%e9%81%93","status":"publish","type":"post","link":"https:\/\/dayandcarrot.space\/?p=2300","title":{"rendered":"Indeed Tokyo \u7b14\u8bd5\u9898\u4e00\u9053"},"content":{"rendered":"<p>Indeed\u7684\u7b14\u8bd5\u4e00\u6b21\u4e00\u51714\u9053\uff0c\u9119\u4eba\u7b2c\u4e00\u6b21\u505a\uff0c\u524d\u4e09\u98981hr\u5c31\u641e\u5b9a\u4e86\uff0c\u552f\u72ec\u6700\u540e\u4e00\u9898\u767e\u601d\u4e0d\u5f97\u5176\u89e3\uff0c\u540e\u6765\u770b\u4e86\u5927\u795e\u7684\u601d\u8def\u540e\u5e61\u7136\u9192\u609f\uff0c\u786e\u5b9e\u8111\u5b50\u6ca1\u8f6c\u8fc7\u6765\u554a\uff01<br \/>\n\u9898\u76ee\u5927\u81f4\u5982\u4e0b\uff1a<br \/>\n\u8f93\u5165\u5b57\u7b26\u4e32<span class=\"lang:default decode:true crayon-inline \">str=a[0] a[1] &#8230; a[N]<\/span>\u00a0\uff0c\u5176\u4e2d0&lt;N&lt;=10^5\u3002\u5b57\u7b26\u4e32\u7684\u6bcf\u4e00\u4f4d\u662f0-9\u6216?\uff0c\u9700\u8981\u75280-9\u586b\u5145\u5404\u4e2a\u95ee\u53f7\u7684\u503c\uff0c\u4f7f\u5f97\u6574\u4e2a\u5b57\u7b26\u4e32\u6210\u4e3a\u4e00\u4e2a\u6570\uff08\u5141\u8bb8\u524d\u5bfc0\uff09\uff0c\u5e76\u4e14\u6ee1\u8db3\u4efb\u610f\u8fde\u7eed10\u4f4d\u4e0a\u7684\u5b57\u7b26(\u6216\u7406\u89e3\u6210\u6570\u5b57)<span class=\"lang:default decode:true crayon-inline \">a[i] a[i+1] &#8230; a[i+9] <\/span>\u00a0\u4e0d\u91cd\u590d\uff0c\u8f93\u51fa\u89e3\u7684\u4e2a\u6570\u3002<br \/>\n\u4f8b\u5982\uff0c\u8f93\u5165&#8221;04??2?7&#8243;\uff0c\u8f93\u51fa\u5e94\u5f53\u4e3a120.<br \/>\n&nbsp;<br \/>\n\u6700\u7b80\u5355\u7684\u601d\u8def\u5f53\u7136\u662f\u56de\u6eaf\uff0c\u56de\u6eaf\u7528\u9012\u5f52\u7684\u8bdd\u5bb9\u6613\u7206\u6808\uff0c\u53ef\u4ee5\u81ea\u5df1\u5b9a\u4e49\u6808\u7ed3\u6784\u3002\u4f46\u5b9e\u73b0\u5b8c\u4e86\u6211\u53d1\u73b0\u6548\u7387\u592a\u4f4e\u4e86\u3002\u8fd9\u79cd\u89e3\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(N!).<br \/>\n\u7f51\u4e0a\u7ed9\u4e86\u4e00\u4e2a\u5341\u5206\u7b80\u5355\u7684\u601d\u8def\uff1a<strong>\u53ea\u8ba1\u7b97str\u524d10\u4e2a\u5b57\u7b26\u6709\u591a\u5c11\u53ef\u80fd\u6027<\/strong>\u3002<br \/>\n\u8fd9\u6837\u505a\u53ef\u884c\u5426\uff1f\u4e0d\u59a8\u8bd5\u8bd5\u770b\u3002<br \/>\n\u5047\u8bbe\u5df2\u7ecf\u77e5\u9053\u4e86\u524d10\u4e2a\u5b57\u7b26a[0]&#8230;a[9]\u80fd\u5f97\u5230\u89e3\u7684\u6570\u76ee\uff08\u5b9a\u4f5cM\uff09\uff0c\u90a3\u4e48\u6839\u636e\u89c4\u5219\uff0c\u5728a[10]\u7684\u65f6\u5019\u8981\u8003\u8651a[1]&#8230;a[9]\u7684\u60c5\u51b5\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u79cda[1]\u5230a[9]\u7684\u60c5\u51b5\u800c\u8a00\uff0c\u7531\u4e8e\u5df2\u7ecf\u51b3\u5b9a\u4e869\u4e2a\u6570\u5b57\u4e86\uff0c\u90a3\u4e48\u7b2c10\u4e2a\u6570\u5b57\u663e\u7136\u5df2\u7ecf\u786e\u5b9a\u4e86\u3002\u4ece\u8fd9\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\uff0c\u89e3\u7684\u4e2a\u6570\u80af\u5b9a\u662f\u4e0d\u5927\u4e8eM\u7684\uff0c\u56e0\u4e3a\u5047\u8bbea[10]\u4e0d\u662f\u4e2a&#8221;?&#8221;\u5e76\u4e14a[10]\u53c8\u4e0d\u7b49\u4e8e\u7f3a\u7684\u90a3\u4e2a\u6570\u5b57\u7684\u8bdd\uff0c\u90a3\u8fd9\u4e2acase\u662f\u8981\u88ab\u6bd9\u6389\u7684\u3002\u7136\u540e\u4ee5\u6b64\u7c7b\u63a8\uff0c\u68c0\u6d4ba[11], a[12], .. a[N]. \u6309\u7167\u8fd9\u79cd\u7b97\u6cd5\uff0c\u6574\u4e2a\u95ee\u9898\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(10! * N)=O(N).<br \/>\n==\u66f4\u65b0==<br \/>\n\u8fd8\u6709\u4e00\u4e2a\u66f4\u9ad8\u6548\u7684\u89e3\u6cd5\uff0c\u4e3b\u8981\u601d\u8def\u662f\u5229\u7528\u540e\u9762\u201c\u5faa\u73af\u6570\u201d\u5f97\u5230\u7684\u786e\u5b9a\u4fe1\u606f\u6765\u586b\u5145\u524d\u9762\u7684?\uff0c\u7136\u540e\u76f4\u63a5\u8ba1\u7b97\u7ec4\u5408\u6570\u5373\u53ef\u3002\u5177\u4f53\u53ef\u4ee5\u770b<a href=\"http:\/\/gaomf.cn\/2016\/10\/26\/String_Fill\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/gaomf.cn\/2016\/10\/26\/String_Fill\/<\/a><br \/>\n========<br \/>\n\u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default decode:true \">\u8f93\u5165\uff1a\u957f\u5ea6\u4e3aN\u7684\u5b57\u7b26\u4e32str\n\u6b65\u9aa4\uff1a\n0. result_count=0\n1. \u68c0\u67e5\u524d10\u4e2a\u5b57\u7b26str[0]...str[9]\u4e2d\u6570\u5b57\u51b2\u7a81\u60c5\u51b5:\n  1.1 \u82e5\u6709\u51b2\u7a81\uff0creturn 0\n2. \u6c42\u51fa\u6240\u6709\u586b\u5145str[0...9]\u4e2d'?'\u7684\u65b9\u6cd5solution_m=[str[0],...,str[9]]\n  foreach solution_m:\n    for index = 10,...N-1:\n      if str[index]=='?':\n        continue # \u67e5\u627e\u4e0b\u4e00\u4e2a\n      else if str[index] == solution_m[index%10]:\n        continue # \u67e5\u627e\u4e0b\u4e00\u4e2a\n      else\n        break # \u8fd9\u4e2asolution\u65e0\u6cd5\u6ee1\u8db3\u9650\u5236\n    if solution_m \u901a\u8fc7\u68c0\u67e5:\n      result_count++\n\u8f93\u51fa: \u6ee1\u8db3\u6761\u4ef6\u7684solution\u8ba1\u6570result_count<\/pre>\n<p>\u6362\u4e2a\u8bf4\u6cd5\u5c31\u662f\uff0c\u540e\u9762\u7684\u6570\u5b57\u80af\u5b9a\u662f\u524d\u976210\u4e2a\u6570\u5b57\u7684\u5faa\u73af\uff0c\u56e0\u4e3a\u65b0\u52a0\u7684a[i]\u80af\u5b9a\u662f\u5f97\u9876\u66ff\u4e0aa[i-10]\u7684\u4f4d\u7f6e\u7684\u3002<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Indeed\u7684\u7b14\u8bd5\u4e00\u6b21\u4e00\u51714\u9053\uff0c\u9119\u4eba\u7b2c\u4e00\u6b21\u505a\uff0c\u524d\u4e09\u98981hr\u5c31\u641e\u5b9a\u4e86\uff0c\u552f\u72ec\u6700\u540e\u4e00\u9898\u767e\u601d\u4e0d\u5f97\u5176\u89e3\uff0c\u540e\u6765\u770b\u4e86\u5927\u795e\u7684\u601d\u8def\u540e\u5e61\u7136\u9192\u609f\uff0c\u786e\u5b9e\u8111\u5b50\u6ca1\u8f6c\u8fc7\u6765\u554a\uff01 \u9898\u76ee\u5927\u81f4\u5982\u4e0b\uff1a \u8f93\u5165\u5b57\u7b26\u4e32str=a[0] a[1] &#8230; a[N]\u00a0\uff0c\u5176\u4e2d0&lt;N&lt;=10^5\u3002\u5b57\u7b26\u4e32\u7684\u6bcf\u4e00\u4f4d\u662f0-9\u6216?\uff0c\u9700\u8981\u75280-9\u586b\u5145\u5404\u4e2a\u95ee\u53f7\u7684\u503c\uff0c\u4f7f\u5f97\u6574\u4e2a\u5b57\u7b26\u4e32\u6210\u4e3a\u4e00\u4e2a\u6570\uff08\u5141\u8bb8\u524d\u5bfc0\uff09\uff0c\u5e76\u4e14\u6ee1\u8db3\u4efb\u610f\u8fde\u7eed10\u4f4d\u4e0a\u7684\u5b57\u7b26(\u6216\u7406\u89e3\u6210\u6570\u5b57)a[i] a[i+1] &#8230; a[i+9] \u00a0\u4e0d\u91cd\u590d\uff0c\u8f93\u51fa\u89e3\u7684\u4e2a\u6570\u3002 \u4f8b\u5982\uff0c\u8f93\u5165&#8221;04??2?7&#8243;\uff0c\u8f93\u51fa\u5e94\u5f53\u4e3a120. &nbsp; \u6700\u7b80\u5355\u7684\u601d\u8def\u5f53\u7136\u662f\u56de\u6eaf\uff0c\u56de\u6eaf\u7528\u9012\u5f52\u7684\u8bdd\u5bb9\u6613\u7206\u6808\uff0c\u53ef\u4ee5\u81ea\u5df1\u5b9a\u4e49\u6808\u7ed3\u6784\u3002\u4f46\u5b9e\u73b0\u5b8c\u4e86\u6211\u53d1\u73b0\u6548\u7387\u592a\u4f4e\u4e86\u3002\u8fd9\u79cd\u89e3\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(N!). \u7f51\u4e0a\u7ed9\u4e86\u4e00\u4e2a\u5341\u5206\u7b80\u5355\u7684\u601d\u8def\uff1a\u53ea\u8ba1\u7b97str\u524d10\u4e2a\u5b57\u7b26\u6709\u591a\u5c11\u53ef\u80fd\u6027\u3002 \u8fd9\u6837\u505a\u53ef\u884c\u5426\uff1f\u4e0d\u59a8\u8bd5\u8bd5\u770b\u3002 \u5047\u8bbe\u5df2\u7ecf\u77e5\u9053\u4e86\u524d10\u4e2a\u5b57\u7b26a[0]&#8230;a[9]\u80fd\u5f97\u5230\u89e3\u7684\u6570\u76ee\uff08\u5b9a\u4f5cM\uff09\uff0c\u90a3\u4e48\u6839\u636e\u89c4\u5219\uff0c\u5728a[10]\u7684\u65f6\u5019\u8981\u8003\u8651a[1]&#8230;a[9]\u7684\u60c5\u51b5\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u79cda[1]\u5230a[9]\u7684\u60c5\u51b5\u800c\u8a00\uff0c\u7531\u4e8e\u5df2\u7ecf\u51b3\u5b9a\u4e869\u4e2a\u6570\u5b57\u4e86\uff0c\u90a3\u4e48\u7b2c10\u4e2a\u6570\u5b57\u663e\u7136\u5df2\u7ecf\u786e\u5b9a\u4e86\u3002\u4ece\u8fd9\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\uff0c\u89e3\u7684\u4e2a\u6570\u80af\u5b9a\u662f\u4e0d\u5927\u4e8eM\u7684\uff0c\u56e0\u4e3a\u5047\u8bbea[10]\u4e0d\u662f\u4e2a&#8221;?&#8221;\u5e76\u4e14a[10]\u53c8\u4e0d\u7b49\u4e8e\u7f3a\u7684\u90a3\u4e2a\u6570\u5b57\u7684\u8bdd\uff0c\u90a3\u8fd9\u4e2acase\u662f\u8981\u88ab\u6bd9\u6389\u7684\u3002\u7136\u540e\u4ee5\u6b64\u7c7b\u63a8\uff0c\u68c0\u6d4ba[11], a[12], .. a[N]. \u6309\u7167\u8fd9\u79cd\u7b97\u6cd5\uff0c\u6574\u4e2a\u95ee\u9898\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(10! * N)=O(N). ==\u66f4\u65b0== \u8fd8\u6709\u4e00\u4e2a\u66f4\u9ad8\u6548\u7684\u89e3\u6cd5\uff0c\u4e3b\u8981\u601d\u8def\u662f\u5229\u7528\u540e\u9762\u201c\u5faa\u73af\u6570\u201d\u5f97\u5230\u7684\u786e\u5b9a\u4fe1\u606f\u6765\u586b\u5145\u524d\u9762\u7684?\uff0c\u7136\u540e\u76f4\u63a5\u8ba1\u7b97\u7ec4\u5408\u6570\u5373\u53ef\u3002\u5177\u4f53\u53ef\u4ee5\u770bhttp:\/\/gaomf.cn\/2016\/10\/26\/String_Fill\/ ======== \u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a \u8f93\u5165\uff1a\u957f\u5ea6\u4e3aN\u7684\u5b57\u7b26\u4e32str \u6b65\u9aa4\uff1a 0. result_count=0 1. \u68c0\u67e5\u524d10\u4e2a\u5b57\u7b26str[0]&#8230;str[9]\u4e2d\u6570\u5b57\u51b2\u7a81\u60c5\u51b5: 1.1 \u82e5\u6709\u51b2\u7a81\uff0creturn 0 2. \u6c42\u51fa\u6240\u6709\u586b\u5145str[0&#8230;9]\u4e2d&#8217;?&#8217;\u7684\u65b9\u6cd5solution_m=[str[0],&#8230;,str[9]] foreach solution_m: for index = 10,&#8230;N-1: if str[index]==&#8217;?&#8217;: continue # \u67e5\u627e\u4e0b\u4e00\u4e2a else if str[index] == solution_m[index%10]: continue # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[183],"class_list":["post-2300","post","type-post","status-publish","format-standard","hentry","category-technical","tag-183"],"_links":{"self":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/2300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2300"}],"version-history":[{"count":0,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/2300\/revisions"}],"wp:attachment":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}