{"id":200114,"date":"2020-11-15T07:38:12","date_gmt":"2020-11-14T23:38:12","guid":{"rendered":"http:\/\/4563.org\/?p=200114"},"modified":"2020-11-15T07:38:12","modified_gmt":"2020-11-14T23:38:12","slug":"%e8%af%b4%e5%87%a0%e4%b8%aa-leetcode-%e4%b8%8a%e7%9c%8b%e4%bc%bc%e7%ae%80%e5%8d%95%e5%8d%b4%e5%8f%88%e9%9d%9e%e5%b8%b8%e5%9b%b0%e9%9a%be%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=200114","title":{"rendered":"\u8bf4\u51e0\u4e2a leetcode \u4e0a\u770b\u4f3c\u7b80\u5355\u5374\u53c8\u975e\u5e38\u56f0\u96be\u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf4\u51e0\u4e2a leetcode \u4e0a\u770b\u4f3c\u7b80\u5355\u5374\u53c8\u975e\u5e38\u56f0\u96be\u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Goldilocks <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<ol>\n<li>Merge two sorted array<\/li>\n<\/ol>\n<p>https:\/\/leetcode.com\/problems\/merge-sorted-array\/<\/p>\n<p>Q1: \u7b97\u6cd5\u590d\u6742\u5ea6\u7684\u4e0b\u754c\u662f\u591a\u5c11\uff1f\u5982\u4f55\u7b97\u51fa\u6765\u7684\uff1f<\/p>\n<p>Q2: \u5e38\u89c4\u4e24\u4e2a\u6307\u9488\u7ebf\u6027\u7684\u5f80\u524d\u8d70\u8c01\u90fd\u4f1a\u5199\uff0c\u4f46\u662f\u5982\u4f55 binary search \u52a0\u901f\u5b83?aka. binary search merge<\/p>\n<ol>\n<li>Shuffle the Array<\/li>\n<\/ol>\n<p>https:\/\/leetcode.com\/problems\/shuffle-the-array<\/p>\n<p>\u5982\u4f55 inplace \u7684\u5728\u7ebf\u6027\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u5b8c\u6210\u5b83\uff1f\u5982\u4f55\u8bc1\u660e\u4f60\u7684\u7b97\u6cd5\u662f\u5bf9\u7684\uff1f<\/p>\n<p>\u8fd9\u4e2a\u9898\u5176\u5b9e\u662f\u5728\u8003\u5bdf\u4f60\u5bf9\u62bd\u8c61\u4ee3\u6570\u7684\u7406\u89e3\u3002\u56e0\u4e3a\u8fd9\u4e2a\u6240\u8c13\u7684 shuffle \u5c31\u662f permutation \u3002permutation group \u53ef\u4ee5\u88ab\u5206\u89e3\u6210 orbits \u3002\u7136\u540e\u4f60\u5c31\u53ea\u9700\u8981\u4e00\u4e2a orbit \u3001\u4e00\u4e2a orbit \u7684\u53bb\u5904\u7406\u5c31\u884c\u4e86\u3002\u4f46\u662f\u5982\u4f55\u627e\u51fa\u8fd9\u4e9b orbits \u5462\uff1f\u80fd\u4e0d\u80fd\u540c\u65f6\u5904\u7406\u591a\u4e2a orbits \u5462\uff1f<\/p>\n<ol>\n<li>Running Sum of 1d Array https:\/\/leetcode.com\/problems\/running-sum-of-1d-array\/<\/li>\n<\/ol>\n<p>\u770b\u8d77\u6765\u5f88\u7b80\u5355\u662f\u5427\uff1f \u5982\u679c\u662f\u6d6e\u70b9\u6570\u600e\u4e48\u529e\uff1f\u5982\u4f55\u5229\u7528 binary tree \u6700\u5c0f\u5316\u8ba1\u7b97\u8bef\u5dee\uff1f<\/p>\n<ol>\n<li>find the median number of an array<\/li>\n<\/ol>\n<p>\u300a\u7b97\u6cd5\u5bfc\u8bba\u300b\u82b1\u4e86\u5f88\u5927\u7684\u7bc7\u5e45\u53bb\u8bb2\u8fd9\u4e2a\u95ee\u9898\uff0c\u6ca1\u6709\u8ba4\u771f\u5b66\u8fc7\u7684\u4eba\u80af\u5b9a\u662f\u4e0d\u61c2\u7684\uff0c\u5c24\u5176\u662f\u90a3\u4e2a\u6700\u574f\u60c5\u51b5\u4e3a\u7ebf\u6027\u65f6\u95f4\u7684\u9009\u62e9\u7b97\u6cd5\uff0c\u4e3a\u4ec0\u4e48\u300a\u7b97\u6cd5\u5bfc\u8bba\u300b\u4e0a\u662f\u6bcf 5 \u4e2a\u4e00\u7ec4\u4f46\u662f TAOCP \u4e0a\u7684\u63cf\u8ff0\u662f 7 \u4e2a\u4e00\u7ec4\uff1f\u9664\u4e86\u8fd9\u4e9b textbook \u7b97\u6cd5\u5916\uff0c\u4f60\u8fd8\u6709\u4ec0\u4e48 idea \uff1f\u6bd4\u5982\u5982\u4f55\u7528\u6982\u7387\u8bba\u548c\u7edf\u8ba1\u5b66\u77e5\u8bc6\u5f00\u53d1\u4e00\u4e2a\u671f\u671b\u7ebf\u6027\u7684\u968f\u673a\u5316\u7b97\u6cd5\uff1f<\/p>\n<p>\u4e00\u5473\u7684\u5237\u9898\u662f\u6ca1\u6709\u7528\u7684\uff0c\u5bf9\u4e8e\u627e\u5230\u8fd9\u4e9b easy \u95ee\u9898\u7684\u7b54\u6848\u6ca1\u6709\u5e2e\u52a9\u3002<\/p>\n<p>\u540c\u65f6\u8fd9\u4e5f\u56de\u7b54\u4e86\u53e6\u4e00\u4e2a\u95ee\u9898\uff1a\u9762\u8bd5\u7684\u65f6\u5019\u600e\u4e48\u5224\u65ad\u9762\u8bd5\u8005\u662f\u4e0d\u662f\u901f\u6210\u7684\uff1f \u5f88\u7b80\u5355\uff0c\u8ba4\u771f\u5b66\u8fc7\u7b97\u6cd5\u7684\u79d1\u73ed\u5b66\u751f\uff0c\u591a\u5c11\u4f1a\u5bf9\u8fd9\u4e9b\u95ee\u9898\u6709\u4e9b sense \u3002\u800c\u901f\u6210\u7684\u53ea\u80fd\u9760\u5237\u9898\uff0c\u5237\u4e0d\u51fa\u8fd9\u4e9b idea \u3002\u4ed6\u751a\u81f3\u4e0d\u77e5\u9053 binary search merge \u7684\u5b58\u5728\u3002\u4f46\u662f\u5982\u679c\u4ed6\u4f46\u51e1\u770b\u8fc7 MIT \u3001\u666e\u6797\u65af\u987f\u6216\u4efb\u4f55\u4e00\u4e2a\u540d\u6821\u7684\u7b97\u6cd5\u516c\u5f00\u8bfe\uff0c\u4ed6\u90fd\u4f1a\u77e5\u9053 binary merge\/median find \u4e0d\u662f\u90a3\u4e48\u7684\u7b80\u5355\u7684\u95ee\u9898\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4117478\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Girlphobia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u575a\u5b9a\u4e86\u6211\u6709\u7a7a\u4e00\u5b9a\u8981\u628a\u57ab\u663e\u793a\u5668\u7684\u300a\u7b97\u6cd5\u5bfc\u8bba\u300b\u62ff\u51fa\u6765\u4ed4\u7ec6\u770b\u4e00\u904d\u7684\u51b3\u5fc3\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4117479\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : daozhihun <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4f60\u53ea\u662f\u60f3\u8981\u77e5\u9053\u522b\u4eba\u662f\u5426\u8ba4\u771f\u5b66\u8fc7\u7b97\u6cd5\uff0c\u76f4\u63a5\u51fa\u4e2a\u9898\u76ee\u8003\u7f51\u7edc\u6d41\u7b97\u6cd5\u3001A*\u641c\u7d22\u526a\u679d\u4e0d\u662f\u66f4\u597d\u5417\uff1f<br \/>\u6211\u89c9\u5f97\u9762\u8bd5\u7684\u76ee\u7684\u662f\u8003\u5bdf\u5bf9\u65b9\u7684\u601d\u7ef4\u80fd\u529b\uff0c\u800c\u4e0d\u662f\u5355\u7eaf\u5730\u5224\u65ad\u4ed6\u662f\u5426\u770b\u8fc7\u54ea\u4e9b\u516c\u5f00\u8bfe\u4ec0\u4e48\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4117480\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lights <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u662f\u8981\u9020\u706b\u7bad\u8fd8\u662f\u9020\u65e0\u4eba\u6c7d\u8f66\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4117481\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GtDzx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             binary search merge \u662f\u5565\uff1f \u600e\u4e48\u52a0\u901f\u7684\uff1f \u8fd8\u771f\u6ca1\u542c\u8bf4\u8fc7&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4117482\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SingeeKing <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @GtDzx \u7b80\u5355\u8bf4\u5c31\u662f\u4e3b\u5217\u4e3e\u7684\u7b2c\u4e00\u9898\u7684 O(logN) \u89e3\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4117483\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GtDzx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SingeeKing \u8fd9\u9898\u81f3\u5c11\u8981\u628a 2 \u4e2a\u6570\u7ec4\u904d\u5386\u4e00\u904d\u5427\uff0c\u8fd8\u80fd O(logN)? \u8bb2\u8bb2\u600e\u4e48\u505a\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u51e0\u4e2a leetcode \u4e0a\u770b\u4f3c\u7b80&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/200114"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=200114"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/200114\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=200114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=200114"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=200114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}