{"id":3224,"date":"2023-10-22T13:23:15","date_gmt":"2023-10-22T05:23:15","guid":{"rendered":"https:\/\/white-night.club\/?p=3224"},"modified":"2023-11-09T11:07:47","modified_gmt":"2023-11-09T03:07:47","slug":"ad86","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/22\/ad86\/","title":{"rendered":"2848.\u00a0\u4e0e\u8f66\u76f8\u4ea4\u7684\u70b9"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e00\u4e2a\u4e0b\u6807\u4ece\u00a0<strong>0<\/strong>\u00a0\u5f00\u59cb\u7684\u4e8c\u7ef4\u6574\u6570\u6570\u7ec4\u00a0<code>nums<\/code>\u00a0\u8868\u793a\u6c7d\u8f66\u505c\u653e\u5728\u6570\u8f74\u4e0a\u7684\u5750\u6807\u3002\u5bf9\u4e8e\u4efb\u610f\u4e0b\u6807\u00a0<code>i<\/code>\uff0c<code>nums[i] = [start<sub>i<\/sub>, end<sub>i<\/sub>]<\/code>\u00a0\uff0c\u5176\u4e2d\u00a0<code>start<sub>i<\/sub><\/code>\u00a0\u662f\u7b2c\u00a0<code>i<\/code>\u00a0\u8f86\u8f66\u7684\u8d77\u70b9\uff0c<code>end<sub>i<\/sub><\/code>\u00a0\u662f\u7b2c\u00a0<code>i<\/code>\u00a0\u8f86\u8f66\u7684\u7ec8\u70b9\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u6570\u8f74\u4e0a\u88ab\u8f66&nbsp;<strong>\u4efb\u610f\u90e8\u5206<\/strong>&nbsp;\u8986\u76d6\u7684\u6574\u6570\u70b9\u7684\u6570\u76ee\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>nums = [[3,6],[1,5],[4,7]]\n<strong>\u8f93\u51fa\uff1a<\/strong>7\n<strong>\u89e3\u91ca\uff1a<\/strong>\u4ece 1 \u5230 7 \u7684\u6240\u6709\u70b9\u90fd\u81f3\u5c11\u4e0e\u4e00\u8f86\u8f66\u76f8\u4ea4\uff0c\u56e0\u6b64\u7b54\u6848\u4e3a 7 \u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>nums = [[1,3],[5,8]]\n<strong>\u8f93\u51fa\uff1a<\/strong>7\n<strong>\u89e3\u91ca\uff1a<\/strong>1\u30012\u30013\u30015\u30016\u30017\u30018 \u5171\u8ba1 7 \u4e2a\u70b9\u6ee1\u8db3\u81f3\u5c11\u4e0e\u4e00\u8f86\u8f66\u76f8\u4ea4\uff0c\u56e0\u6b64\u7b54\u6848\u4e3a 7 \u3002\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= nums.length &lt;= 100<\/code><\/li>\n\n\n\n<li><code>nums[i].length == 2<\/code><\/li>\n\n\n\n<li><code>1 &lt;= start<sub>i<\/sub>&nbsp;&lt;= end<sub>i<\/sub>&nbsp;&lt;= 100<\/code><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u5dee\u5206\u6570\u7ec4<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u6211\u662f\u4e0d\u77e5\u9053\u4e3a\u5565\u8981\u5212\u5206\u5230\u524d\u7f00\u548c\u5206\u7c7b\u7684\uff0c\u6700\u540e\u6bd5\u7adf\u662f\u5bf9\u6574\u4e2adiff\u6570\u7ec4\u6c42\u548c\uff0c\u4f46\u53c8\u611f\u89c9\u7ef4\u62a4diff\u6570\u7ec4\u7684\u65f6\u5019\u53c8\u6709\u90a3\u4e48\u70b9\u524d\u7f00\u548c\u7684\u601d\u60f3\u5728\u91cc\u5934\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\r\npublic:\r\n    int numberOfPoints(vector&lt;vector&lt;int>>&amp; nums) {\r\n        int diff&#91;102]{0};\r\n        int result=0;\r\n        for(auto &amp;i:nums)\r\n        {\r\n            diff&#91;i&#91;0]]++;\r\n            diff&#91;i&#91;1]+1]--;\r\n        }\r\n        int sum=0;\r\n        for(int &amp;i:diff)\r\n        {\r\n            sum+=i;\r\n            if(sum>0)\r\n            {\r\n                result++;\r\n            }\r\n        }\r\n        return result;\r\n    }\r\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u5dee\u5206\u6570\u7ec4<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3224"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=3224"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3224\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=3224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}