{"id":255,"date":"2024-01-16T23:54:04","date_gmt":"2024-01-16T15:54:04","guid":{"rendered":"https:\/\/wangqianming.top\/?p=255"},"modified":"2024-01-16T23:54:04","modified_gmt":"2024-01-16T15:54:04","slug":"%e5%8a%a8%e6%80%81%e8%a7%84%e5%88%922","status":"publish","type":"post","link":"https:\/\/wangqianming.top\/index.php\/2024\/01\/16\/%e5%8a%a8%e6%80%81%e8%a7%84%e5%88%922\/","title":{"rendered":"\u52a8\u6001\u89c4\u52122"},"content":{"rendered":"<h1>\u5b8c\u5168\u5e73\u65b9\u6570<\/h1>\n<p>\u7ed9\u4f60\u4e00\u4e2a\u6574\u6570 <code>n<\/code> \uff0c\u8fd4\u56de \u548c\u4e3a <code>n<\/code> \u7684\u5b8c\u5168\u5e73\u65b9\u6570\u7684\u6700\u5c11\u6570\u91cf \u3002<\/p>\n<p>\u5b8c\u5168\u5e73\u65b9\u6570 \u662f\u4e00\u4e2a\u6574\u6570\uff0c\u5176\u503c\u7b49\u4e8e\u53e6\u4e00\u4e2a\u6574\u6570\u7684\u5e73\u65b9\uff1b\u6362\u53e5\u8bdd\u8bf4\uff0c\u5176\u503c\u7b49\u4e8e\u4e00\u4e2a\u6574\u6570\u81ea\u4e58\u7684\u79ef\u3002\u4f8b\u5982\uff0c1\u30014\u30019 \u548c 16 \u90fd\u662f\u5b8c\u5168\u5e73\u65b9\u6570\uff0c\u800c 3 \u548c 11 \u4e0d\u662f\u3002<\/p>\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n<blockquote>\n<p>\u8f93\u5165\uff1an = 12<br \/>\n\u8f93\u51fa\uff1a3<br \/>\n\u89e3\u91ca\uff1a12 = 4 + 4 + 4<\/p>\n<\/blockquote>\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n<blockquote>\n<p>\u8f93\u5165\uff1an = 13<br \/>\n\u8f93\u51fa\uff1a2<br \/>\n\u89e3\u91ca\uff1a13 = 4 + 9<\/p>\n<\/blockquote>\n<pre><code class=\"language-java\">class Solution {\n    public int numSquares(int n) {\n        int[] f = new int[n + 1];\n        for (int i = 1; i &lt;= n; i++) {\n            int minn = Integer.MAX_VALUE;\n            for (int j = 1; j * j &lt;= i; j++) {\n                minn = Math.min(minn, f[i - j * j]);\n            }\n            f[i] = minn + 1;\n        }\n        return f[n];\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b8c\u5168\u5e73\u65b9\u6570 \u7ed9\u4f60\u4e00\u4e2a\u6574\u6570 n \uff0c\u8fd4\u56de \u548c\u4e3a n \u7684\u5b8c\u5168\u5e73\u65b9\u6570\u7684\u6700\u5c11\u6570\u91cf \u3002 \u5b8c\u5168\u5e73\u65b9\u6570 \u662f\u4e00\u4e2a\u6574\u6570\uff0c\u5176\u503c\u7b49\u4e8e\u53e6\u4e00\u4e2a\u6574\u6570\u7684\u5e73\u65b9\uff1b\u6362\u53e5 &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,32,9],"class_list":["post-255","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java","tag-32","tag-leetcode"],"_links":{"self":[{"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":1,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":256,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions\/256"}],"wp:attachment":[{"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangqianming.top\/index.php\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}