{"id":5545,"date":"2023-11-23T09:11:12","date_gmt":"2023-11-23T01:11:12","guid":{"rendered":"https:\/\/white-night.club\/?p=5545"},"modified":"2023-11-23T09:22:10","modified_gmt":"2023-11-23T01:22:10","slug":"ad163","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/23\/ad163\/","title":{"rendered":"14.\u00a0\u6700\u957f\u516c\u5171\u524d\u7f00"},"content":{"rendered":"\n<p>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570\u6765\u67e5\u627e\u5b57\u7b26\u4e32\u6570\u7ec4\u4e2d\u7684\u6700\u957f\u516c\u5171\u524d\u7f00\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4e0d\u5b58\u5728\u516c\u5171\u524d\u7f00\uff0c\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32&nbsp;<code>\"\"<\/code>\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><strong>\u8f93\u5165\uff1a<\/strong>strs = [&#8220;flower&#8221;,&#8221;flow&#8221;,&#8221;flight&#8221;] <strong>\u8f93\u51fa\uff1a<\/strong>&#8220;fl&#8221;<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><strong>\u8f93\u5165\uff1a<\/strong>strs = [&#8220;dog&#8221;,&#8221;racecar&#8221;,&#8221;car&#8221;] <strong>\u8f93\u51fa\uff1a<\/strong>&#8220;&#8221; <strong>\u89e3\u91ca\uff1a<\/strong>\u8f93\u5165\u4e0d\u5b58\u5728\u516c\u5171\u524d\u7f00\u3002<\/p>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= strs.length &lt;= 200<\/code><\/li>\n\n\n\n<li><code>0 &lt;= strs[i].length &lt;= 200<\/code><\/li>\n\n\n\n<li><code>strs[i]<\/code>&nbsp;\u4ec5\u7531\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd\u7ec4\u6210<\/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 has-link-color wp-elements-62a4eda666dfa26f3cdabe42f86cce78\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u7eb5\u5411\u626b\u63cf<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u600e\u4e48\u60f3\u5012\u662f\u633a\u7b80\u5355\u7684\uff0c\u4ece\u4e0a\u5230\u4e0b\u4ece\u5de6\u5230\u53f3\u4e00\u4e2a\u4e00\u4e2a\u5b57\u7b26\u4e32\u53bb\u5339\u914d\u5457\uff0c\u8c01\u5148\u5230\u5f53\u524d\u5b57\u7b26\u4e32\u7684\u6700\u5927\u957f\u5ea6\u8c01\u5c31\u662f\u6700\u957f\u516c\u5171\u524d\u7f00\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func longestCommonPrefix(strs &#91;]string) string {\r\n  if len(strs)==0{\r\n    return \" \"\r\n  }\r\n  for i:=0;i&lt;len(strs&#91;0]);i++{\r\n    for j:=0;j&lt;len(strs);j++{\r\n      if len(strs&#91;j])==i||strs&#91;j]&#91;i]!=strs&#91;0]&#91;i]{\r\n        return strs&#91;0]&#91;:i]\r\n      }\r\n    }\r\n  }\r\n  return strs&#91;0]\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u516c\u5171\u524d\u7f00<\/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\/5545"}],"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=5545"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/5545\/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=5545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=5545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=5545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}