{"id":3251,"date":"2023-10-23T11:01:31","date_gmt":"2023-10-23T03:01:31","guid":{"rendered":"https:\/\/white-night.club\/?p=3251"},"modified":"2023-11-09T11:07:47","modified_gmt":"2023-11-09T03:07:47","slug":"ad87","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/23\/ad87\/","title":{"rendered":"603.\u00a0\u8fde\u7eed\u7a7a\u4f59\u5ea7\u4f4d"},"content":{"rendered":"\n<p>\u8868:&nbsp;<code>Cinema<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| seat_id     | int  |\n| free        | bool |\n+-------------+------+\n\u5728 SQL \u4e2d\uff0cSeat_id \u662f\u8be5\u8868\u7684\u81ea\u52a8\u9012\u589e\u4e3b\u952e\u5217\u3002\n\u8be5\u8868\u7684\u6bcf\u4e00\u884c\u8868\u793a\u7b2c i \u4e2a\u5ea7\u4f4d\u662f\u5426\u7a7a\u95f2\u30021 \u8868\u793a\u7a7a\u95f2\uff0c0 \u8868\u793a\u88ab\u5360\u7528\u3002<\/pre>\n\n\n\n<p>\u67e5\u627e\u7535\u5f71\u9662\u6240\u6709\u8fde\u7eed\u53ef\u7528\u7684\u5ea7\u4f4d\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u6309&nbsp;<code>seat_id<\/code>&nbsp;<strong>\u5347\u5e8f\u6392\u5e8f&nbsp;<\/strong>\u7684\u7ed3\u679c\u8868\u3002<\/p>\n\n\n\n<p>\u6d4b\u8bd5\u7528\u4f8b\u7684\u751f\u6210\u4f7f\u5f97\u4e24\u4e2a\u4ee5\u4e0a\u7684\u5ea7\u4f4d\u8fde\u7eed\u53ef\u7528\u3002<\/p>\n\n\n\n<p>\u7ed3\u679c\u8868\u683c\u5f0f\u5982\u4e0b\u6240\u793a\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> \nCinema \u8868:\n+---------+------+\n| seat_id | free |\n+---------+------+\n| 1       | 1    |\n| 2       | 0    |\n| 3       | 1    |\n| 4       | 1    |\n| 5       | 1    |\n+---------+------+\n<strong>\u8f93\u51fa:<\/strong> \n+---------+\n| seat_id |\n+---------+\n| 3       |\n| 4       |\n| 5       |\n+---------+<\/pre>\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>\u81ea\u8054\u7ed3<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u4e00\u5f00\u59cb\u60f3\u7684\u662f\u81ea\u8054\u7ed3\uff0c\u4f46\u662f\u5199\u4e86\u53d1\u73b0\u8fc7\u4e0d\u4e86\u3002\u4ed4\u7ec6\u770b\u4e86\u770b\u4e0d\u80fd\u5199<em>A.seat_id+1 = B.seat_id OR A.seat_id-1=B.seat_id<\/em>\u3002\u53ea\u80fd\u7528ABS\u6c42\u7edd\u5bf9\u503c\u3002<\/p>\n\n\n\n<p>\u597d\u5427\uff0c\u53c8\u8bd5\u4e86\u4e0b\u53d1\u73b0\u662f\u4e00\u5f00\u59cb\u81ea\u8054\u7ed3\u7528\u7684where\u800c\u4e0d\u662fon\u624d\u6ca1\u8fc7\u6d4b\u8bd5\uff0c\u602a\u4e0d\u5f97\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Write your MySQL query statement below\r\nSELECT DISTINCT A.seat_id\r\nFROM Cinema AS A\r\nINNER JOIN Cinema AS B \r\nON A.seat_id-1=B.seat_id OR A.seat_id+1=B.seat_id\r\nWHERE A.free=1 AND B.free=1\r\nORDER BY A.seat_id ASC<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u81ea\u8054\u7ed3<\/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\/3251"}],"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=3251"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3251\/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=3251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}