{"id":292935,"date":"2021-01-19T01:21:31","date_gmt":"2021-01-18T17:21:31","guid":{"rendered":"http:\/\/4563.org\/?p=292935"},"modified":"2021-01-19T01:21:31","modified_gmt":"2021-01-18T17:21:31","slug":"airbnb-%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%9a%e6%8e%a5%e9%9b%a8%e6%b0%b4","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=292935","title":{"rendered":"Airbnb \u9762\u8bd5\u9898\uff1a\u63a5\u96e8\u6c34"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Airbnb \u9762\u8bd5\u9898\uff1a\u63a5\u96e8\u6c34               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zzzrf <\/span>  <span><i><\/i> 8<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h3>\u63cf\u8ff0<\/h3>\n<p>\u7ed9\u51fa n \u4e2a\u975e\u8d1f\u6574\u6570\uff0c\u4ee3\u8868\u4e00\u5f20 X \u8f74\u4e0a\u6bcf\u4e2a\u533a\u57df\u5bbd\u5ea6\u4e3a 1 \u7684\u6d77\u62d4\u56fe, \u8ba1\u7b97\u8fd9\u4e2a\u6d77\u62d4\u56fe\u6700\u591a\u80fd\u63a5\u4f4f\u591a\u5c11\uff08\u9762\u79ef\uff09\u96e8\u6c34\u3002<\/p>\n<p>\u5728\u7ebf\u8bc4\u6d4b\u5730\u5740<\/p>\n<h3>\u6837\u4f8b 1<\/h3>\n<pre><code>\u8f93\u5165: [0,1,0] \u8f93\u51fa: 0 <\/code><\/pre>\n<h3>\u6837\u4f8b 2<\/h3>\n<pre><code>\u8f93\u5165: [0,1,0,2,1,0,1,3,2,1,2,1] \u8f93\u51fa: 6 <\/code><\/pre>\n<h3>\u89e3\u6cd5\u601d\u8def<\/h3>\n<ul>\n<li>\u4f7f\u7528\u4e5d\u7ae0\u7b97\u6cd5\u73ed\u4e2d\u8bb2\u8fc7\u7684\u76f8\u5411\u578b\u53cc\u6307\u9488\u7b97\u6cd5\u3002 \u6574\u4e2a\u7b97\u6cd5\u7684\u601d\u60f3\u662f\u8ba1\u7b97\u6bcf\u4e2a\u4f4d\u7f6e\u4e0a\u53ef\u4ee5\u76db\u653e\u7684\u6c34\uff0c\u7d2f\u52a0\u8d77\u6765\u3002<\/li>\n<li>\u8bb0\u5f55\u5982\u4e0b\u51e0\u4e2a\u503c\uff1a<\/li>\n<li>left, right =&gt; \u5de6\u53f3\u6307\u9488\u7684\u4f4d\u7f6e<\/li>\n<li>left_max, right_max =&gt; \u4ece\u5de6\u5230\u53f3\u548c\u4ece\u53f3\u5230\u5de6\u5230 left, right \u4e3a\u6b62\uff0c\u627e\u5230\u7684\u6700\u5927\u7684 height<\/li>\n<li>\u6bcf\u6b21\u6bd4\u8f83 left_max \u548c right_max\uff0c\u5982\u679c left_max \u6bd4\u8f83\u5c0f\uff0c\u5c31\u632a\u52a8 left \u5230 left + 1 \u3002 \u4e0e\u6b64\u540c\u65f6\uff0c\u67e5\u770b left \u8fd9\u4e2a\u4f4d\u7f6e\u4e0a\u80fd\u591f\u76db\u653e\u591a\u5c11\u6c34\uff0c\u8fd9\u91cc\u6709\u4e24\u79cd\u60c5\u51b5\uff1a<\/li>\n<li>\u4e00\u79cd\u662f left_max &gt; heightsleft\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6c34\u53ef\u4ee5\u76db\u653e left_max &#8211; heightsleft \u90a3\u4e48\u591a\u3002\u56e0\u4e3a\u53f3\u8fb9\u6709 right_max \u6321\u7740\uff0c\u5de6\u4fa7\u53ef\u4ee5\u5230 left_max \u3002<\/li>\n<li>\u4e00\u79cd\u662f left_max &lt;= heightsleft\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6c34\u65e0\u6cd5\u76db\u653e\uff0c\u4f1a\u4ece\u5de6\u4fa7\u6d41\u8d70\uff0c\u6b64\u65f6\u66f4\u65b0 left_max \u4e3a heightsleft<\/li>\n<li>left_max &gt;= right_max \u7684\u60c5\u51b5\u7c7b\u4f3c\u5904\u7406\u3002<\/li>\n<\/ul>\n<h3>\u7b97\u6cd5\u590d\u6742\u5ea6<\/h3>\n<ul>\n<li>\u65f6\u95f4\u590d\u6742\u5ea6\uff1aO(n)O(n)\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6 O(1)<\/li>\n<\/ul>\n<pre><code>class Solution:     \"\"\"     @param heights: a list of integers     @return: a integer     \"\"\"     def trapRainWater(self, heights):         if not heights:             return 0                      left, right = 0, len(heights) - 1         left_max, right_max = heights[left], heights[right]         water = 0         while left &lt;= right:             if left_max &lt; right_max:                 left_max = max(left_max, heights[left])                 water += left_max - heights[left]                 left += 1             else:                 right_max = max(right_max, heights[right])                 water += right_max - heights[right]                 right -= 1                              return water <\/code><\/pre>\n<p>\u66f4\u591a\u9898\u89e3\u53c2\u8003<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5134334\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vindurriel <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b9a\u4ef7\u597d\u8d35 \u5efa\u8bae\u53bb\u8d5a K12 \u7684\u94b1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5134335\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LyonUp <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             var maxArea = function(height) {<br \/> let ans = 0;<br \/> let l = 0;<br \/> let r = height.length &#8211; 1;<\/p>\n<p> while(l &lt; r){<br \/> ans = Math.max(ans, Math.min(height[l], height[r]) * (r &#8211; l));<\/p>\n<p> if(height[l] &lt; height[r]){<br \/> l++;<br \/> } else {<br \/> r&#8211;;<br \/> }<br \/> }<\/p>\n<p> return ans;<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5134336\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : poplar50 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u8981\u7528\u5355\u8c03\u6808\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Airbnb \u9762\u8bd5\u9898\uff1a\u63a5\u96e8\u6c34 \u8cc7\u6df1&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\/292935"}],"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=292935"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/292935\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292935"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}