{"id":75641,"date":"2026-02-12T20:49:32","date_gmt":"2026-02-12T12:49:32","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/75641.html"},"modified":"2026-02-12T20:49:32","modified_gmt":"2026-02-12T12:49:32","slug":"leetcode-224-%e5%9f%ba%e6%9c%ac%e8%ae%a1%e7%ae%97%e5%99%a8%ef%bc%9a%e6%89%8b%e5%86%99%e5%ae%9e%e7%8e%b0%e5%8a%a0%e5%87%8f%e6%8b%ac%e5%8f%b7%e8%bf%90%e7%ae%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/75641.html","title":{"rendered":"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97"},"content":{"rendered":"<p>LeetCode \u4e0a\u7684\u7ecf\u5178\u6808\u5e94\u7528\u9898\u2014\u2014224. \u57fa\u672c\u8ba1\u7b97\u5668&#xff0c;\u8fd9\u9053\u9898\u7684\u6838\u5fc3\u662f\u5b9e\u73b0\u4e00\u4e2a\u652f\u6301 \u52a0\u51cf\u8fd0\u7b97\u3001\u62ec\u53f7\u3001\u7a7a\u683c \u7684\u7b80\u6613\u8ba1\u7b97\u5668&#xff0c;\u5e76\u4e14\u660e\u786e\u7981\u6b62\u4f7f\u7528 eval() \u7b49\u5185\u7f6e\u8868\u8fbe\u5f0f\u8ba1\u7b97\u51fd\u6570&#xff0c;\u5b8c\u5168\u9700\u8981\u6211\u4eec\u624b\u52a8\u89e3\u6790\u5b57\u7b26\u4e32\u3001\u5904\u7406\u8fd0\u7b97\u903b\u8f91\u3002<\/p>\n<p>\u5f88\u591a\u540c\u5b66\u9047\u5230\u8fd9\u9053\u9898\u4f1a\u5934\u75bc&#xff0c;\u5c24\u5176\u662f\u62ec\u53f7\u5e26\u6765\u7684\u8fd0\u7b97\u4f18\u5148\u7ea7\u95ee\u9898&#xff0c;\u4eca\u5929\u5c31\u7ed3\u5408\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801&#xff0c;\u4ece\u9898\u76ee\u7406\u89e3\u5230\u4ee3\u7801\u62c6\u89e3&#xff0c;\u4e00\u6b65\u6b65\u8bb2\u6e05\u695a\u6bcf\u4e00\u6b65\u7684\u903b\u8f91&#xff0c;\u65b0\u624b\u4e5f\u80fd\u8f7b\u677e\u770b\u61c2&#xff01;<\/p>\n<h3>\u4e00\u3001\u9898\u76ee\u56de\u987e&#xff08;LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668&#xff09;<\/h3>\n<h4>\u9898\u76ee\u63cf\u8ff0<\/h4>\n<p>\u7ed9\u4f60\u4e00\u4e2a\u5b57\u7b26\u4e32\u8868\u8fbe\u5f0f s &#xff0c;\u8bf7\u4f60\u5b9e\u73b0\u4e00\u4e2a\u57fa\u672c\u8ba1\u7b97\u5668\u6765\u8ba1\u7b97\u5e76\u8fd4\u56de\u5b83\u7684\u503c\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u8868\u8fbe\u5f0f s \u53ea\u5305\u542b\u6570\u5b57\u3001\u2018&#043;\u2019\u3001\u2018-\u2019\u3001\u2018(\u2019\u3001\u2018)\u2019 \u548c\u7a7a\u683c \u2019 &#039;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u5141\u8bb8\u4f7f\u7528\u4efb\u4f55\u5c06\u5b57\u7b26\u4e32\u4f5c\u4e3a\u6570\u5b66\u8868\u8fbe\u5f0f\u8ba1\u7b97\u7684\u5185\u7f6e\u51fd\u6570&#xff0c;\u6bd4\u5982 eval()&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b&#xff1a;\u8f93\u5165 \u201c(1&#043;(4&#043;5&#043;2)-3)&#043;(6&#043;8)\u201d&#xff0c;\u8f93\u51fa 23&#xff1b;\u8f93\u5165 &#034; 2-1 &#043; 2 &#034;&#xff0c;\u8f93\u51fa 3\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u9898\u76ee\u6838\u5fc3\u96be\u70b9<\/h4>\n<p>\u8fd9\u9053\u9898\u7684\u96be\u70b9\u4e0d\u5728\u4e8e\u52a0\u51cf\u8fd0\u7b97\u672c\u8eab&#xff0c;\u800c\u5728\u4e8e\u4e24\u4e2a\u70b9&#xff1a;<\/p>\n<li>\n<p>\u62ec\u53f7\u7684\u5904\u7406&#xff1a;\u62ec\u53f7\u4f1a\u6539\u53d8\u8fd0\u7b97\u4f18\u5148\u7ea7&#xff0c;\u9700\u8981\u5148\u8ba1\u7b97\u62ec\u53f7\u5185\u7684\u5b50\u8868\u8fbe\u5f0f&#xff0c;\u518d\u5c06\u7ed3\u679c\u4e0e\u62ec\u53f7\u5916\u7684\u5185\u5bb9\u5408\u5e76&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u591a\u4f4d\u6570\u7684\u89e3\u6790&#xff1a;\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u5b57\u53ef\u80fd\u662f\u4e2a\u4f4d\u6570&#xff08;\u5982 \u201c1\u201d&#xff09;&#xff0c;\u4e5f\u53ef\u80fd\u662f\u591a\u4f4d\u6570&#xff08;\u5982 \u201c123\u201d&#xff09;&#xff0c;\u9700\u8981\u6b63\u786e\u62fc\u63a5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7a7a\u683c\u7684\u8fc7\u6ee4&#xff1a;\u7a7a\u683c\u4e0d\u5f71\u54cd\u8ba1\u7b97&#xff0c;\u9700\u8981\u8df3\u8fc7\u4e0d\u5904\u7406\u3002<\/p>\n<\/li>\n<h3>\u4e8c\u3001\u6838\u5fc3\u89e3\u9898\u601d\u8def<\/h3>\n<p>\u89e3\u51b3\u8fd9\u9053\u9898\u7684\u6700\u4f18\u601d\u8def\u662f\u4f7f\u7528 \u6808&#xff08;Stack&#xff09; \u6765\u4fdd\u5b58\u8ba1\u7b97\u8fc7\u7a0b\u4e2d\u7684\u72b6\u6001&#xff0c;\u6838\u5fc3\u903b\u8f91\u56f4\u7ed5\u300c\u62ec\u53f7\u4f18\u5148\u7ea7\u300d\u548c\u300c\u7b26\u53f7\u5904\u7406\u300d\u5c55\u5f00&#xff1a;<\/p>\n<li>\n<p>\u7528\u6808\u4fdd\u5b58\u62ec\u53f7\u5916\u7684\u8ba1\u7b97\u72b6\u6001&#xff1a;\u9047\u5230\u5de6\u62ec\u53f7 \u2018(\u2019 \u65f6&#xff0c;\u5c06\u5f53\u524d\u5df2\u7ecf\u8ba1\u7b97\u51fa\u7684\u7ed3\u679c\u3001\u62ec\u53f7\u524d\u7684\u7b26\u53f7\u4fdd\u5b58\u5230\u6808\u4e2d&#xff0c;\u7136\u540e\u91cd\u7f6e\u72b6\u6001&#xff0c;\u4e13\u95e8\u8ba1\u7b97\u62ec\u53f7\u5185\u7684\u5b50\u8868\u8fbe\u5f0f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7528\u53d8\u91cf\u7ef4\u62a4\u5f53\u524d\u8ba1\u7b97\u72b6\u6001&#xff1a;\u7528 result \u8bb0\u5f55\u5f53\u524d\u5c42\u7ea7&#xff08;\u62ec\u53f7\u5185\/\u5916&#xff09;\u7684\u8ba1\u7b97\u7ed3\u679c&#xff0c;\u7528 sign \u8bb0\u5f55\u5f53\u524d\u6570\u5b57\u7684\u7b26\u53f7&#xff08;\u9ed8\u8ba4\u662f \u2018&#043;\u2019&#xff0c;\u56e0\u4e3a\u8868\u8fbe\u5f0f\u7b2c\u4e00\u4e2a\u6570\u5b57\u9690\u542b\u6b63\u53f7&#xff09;&#xff0c;\u7528 num \u4e34\u65f6\u62fc\u63a5\u591a\u4f4d\u6570&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9047\u5230\u53f3\u62ec\u53f7 \u2018)\u2019 \u65f6&#xff0c;\u5f39\u51fa\u6808\u4e2d\u4fdd\u5b58\u7684\u72b6\u6001&#xff08;\u62ec\u53f7\u5916\u7684\u7ed3\u679c\u548c\u62ec\u53f7\u524d\u7684\u7b26\u53f7&#xff09;&#xff0c;\u5c06\u62ec\u53f7\u5185\u7684\u8ba1\u7b97\u7ed3\u679c\u4e0e\u62ec\u53f7\u5916\u7684\u7ed3\u679c\u5408\u5e76&#xff0c;\u7ee7\u7eed\u540e\u7eed\u8ba1\u7b97&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7a7a\u683c\u76f4\u63a5\u8df3\u8fc7&#xff0c;\u4e0d\u5f71\u54cd\u4efb\u4f55\u8ba1\u7b97\u903b\u8f91\u3002<\/p>\n<\/li>\n<p>\u7b80\u5355\u6765\u8bf4&#xff1a;\u6808\u7684\u4f5c\u7528\u5c31\u662f\u300c\u6682\u5b58\u62ec\u53f7\u5916\u7684\u4e0a\u4e0b\u6587\u300d&#xff0c;\u8ba9\u6211\u4eec\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u62ec\u53f7\u5185\u7684\u8ba1\u7b97&#xff0c;\u8ba1\u7b97\u5b8c\u6210\u540e\u518d\u56de\u9000\u5230\u4e4b\u524d\u7684\u4e0a\u4e0b\u6587\u7ee7\u7eed\u8fd0\u7b97\u3002<\/p>\n<h3>\u4e09\u3001\u5b8c\u6574\u4ee3\u7801\u5b9e\u73b0&#xff08;TypeScript&#xff09;<\/h3>\n<p>\u5148\u4e0a\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801&#xff0c;\u540e\u9762\u9010\u884c\u62c6\u89e3\u6bcf\u4e00\u6b65\u903b\u8f91&#xff0c;\u786e\u4fdd\u6bcf\u4e00\u884c\u4ee3\u7801\u90fd\u8bb2\u660e\u767d&#xff1a;<\/p>\n<p><span class=\"token keyword\">function<\/span> <span class=\"token function\">calculate<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">number<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> stack<span class=\"token operator\">:<\/span> <span class=\"token builtin\">number<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> num <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> sign <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5f53\u524d\u6570\u5b57\u7684\u7b26\u53f7&#xff08;&#043;\/-&#xff09;<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> result <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5f53\u524d\u5c42\u7ea7&#xff08;\u62ec\u53f7\u5185\/\u5916&#xff09;\u7684\u8ba1\u7b97\u7ed3\u679c<\/span><\/p>\n<p>  <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">let<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> s<span class=\"token punctuation\">.<\/span>length<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> c <span class=\"token operator\">&#061;<\/span> s<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 1. \u89e3\u6790\u591a\u4f4d\u6570&#xff08;\u6bd4\u5982&#034;123&#034; -&gt; 123&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token string\">&#039;0&#039;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> c<span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token string\">&#039;9&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      num <span class=\"token operator\">&#061;<\/span> num <span class=\"token operator\">*<\/span> <span class=\"token number\">10<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">.<\/span><span class=\"token function\">charCodeAt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token string\">&#039;0&#039;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">charCodeAt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 2. \u5904\u7406\u5de6\u62ec\u53f7&#xff1a;\u4fdd\u5b58\u5f53\u524d\u72b6\u6001&#xff08;\u7ed3\u679c\u3001\u7b26\u53f7&#xff09;\u5230\u6808&#xff0c;\u91cd\u7f6e\u72b6\u6001\u8ba1\u7b97\u62ec\u53f7\u5185\u7684\u503c<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;(&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4fdd\u5b58\u62ec\u53f7\u5916\u7684\u7ed3\u679c<\/span><br \/>\n      stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>sign <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">?<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">:<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4fdd\u5b58\u62ec\u53f7\u524d\u7684\u7b26\u53f7&#xff08;\u75281\/-1\u4ee3\u66ff&#043;\/-\u66f4\u65b9\u4fbf&#xff09;<\/span><br \/>\n      <span class=\"token comment\">\/\/ \u91cd\u7f6e\u72b6\u6001&#xff0c;\u5f00\u59cb\u8ba1\u7b97\u62ec\u53f7\u5185\u7684\u5b50\u8868\u8fbe\u5f0f<\/span><br \/>\n      result <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n      sign <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ 3. \u5904\u7406\u8fd0\u7b97\u7b26&#xff08;&#043;\/-&#xff09;\u6216\u53f3\u62ec\u53f7&#xff1a;\u7ed3\u7b97\u5f53\u524d\u6570\u5b57<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;-&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">||<\/span> i <span class=\"token operator\">&#061;&#061;&#061;<\/span> s<span class=\"token punctuation\">.<\/span>length <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;)&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token comment\">\/\/ \u6839\u636e\u5f53\u524d\u7b26\u53f7&#xff0c;\u628a\u6570\u5b57\u52a0\u5230\u7ed3\u679c\u4e2d<\/span><br \/>\n      result <span class=\"token operator\">&#043;&#061;<\/span> sign <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">?<\/span> num <span class=\"token operator\">:<\/span> <span class=\"token operator\">&#8211;<\/span>num<span class=\"token punctuation\">;<\/span><br \/>\n      num <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u91cd\u7f6e\u4e34\u65f6\u6570\u5b57<\/span><\/p>\n<p>      <span class=\"token comment\">\/\/ \u66f4\u65b0\u7b26\u53f7&#xff08;\u4ec5\u5f53\u662f&#043;\/-\u65f6&#xff09;<\/span><br \/>\n      <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;-&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        sign <span class=\"token operator\">&#061;<\/span> c<span class=\"token punctuation\">;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><\/p>\n<p>      <span class=\"token comment\">\/\/ 4. \u5904\u7406\u53f3\u62ec\u53f7&#xff1a;\u5f39\u51fa\u6808\u4e2d\u4fdd\u5b58\u7684\u72b6\u6001&#xff0c;\u5408\u5e76\u7ed3\u679c<\/span><br \/>\n      <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;)&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">const<\/span> prevSign <span class=\"token operator\">&#061;<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">!<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u62ec\u53f7\u524d\u7684\u7b26\u53f7&#xff08;1\/-1&#xff09;<\/span><br \/>\n        <span class=\"token keyword\">const<\/span> prevResult <span class=\"token operator\">&#061;<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">!<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u62ec\u53f7\u5916\u7684\u7ed3\u679c<\/span><br \/>\n        result <span class=\"token operator\">&#061;<\/span> prevResult <span class=\"token operator\">&#043;<\/span> prevSign <span class=\"token operator\">*<\/span> result<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5408\u5e76\u62ec\u53f7\u5185\u548c\u62ec\u53f7\u5916\u7684\u7ed3\u679c<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u7a7a\u683c\u76f4\u63a5\u8df3\u8fc7&#xff0c;\u65e0\u9700\u5904\u7406<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token keyword\">return<\/span> result<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u56db\u3001\u4ee3\u7801\u9010\u884c\u62c6\u89e3&#xff08;\u6838\u5fc3\u903b\u8f91\u7cbe\u8bb2&#xff09;<\/h3>\n<p>\u6211\u4eec\u6309\u300c\u521d\u59cb\u5316\u53d8\u91cf \u2192 \u904d\u5386\u5b57\u7b26\u4e32 \u2192 \u5404\u573a\u666f\u5904\u7406 \u2192 \u6700\u7ec8\u8fd4\u56de\u7ed3\u679c\u300d\u7684\u987a\u5e8f&#xff0c;\u9010\u5757\u62c6\u89e3\u4ee3\u7801&#xff0c;\u91cd\u70b9\u8bb2\u6e05\u695a\u6808\u7684\u7528\u6cd5\u548c\u62ec\u53f7\u5904\u7406\u903b\u8f91\u3002<\/p>\n<h4>1. \u521d\u59cb\u5316\u53d8\u91cf&#xff08;\u5173\u952e\u53d8\u91cf\u8bf4\u660e&#xff09;<\/h4>\n<p><span class=\"token keyword\">const<\/span> stack<span class=\"token operator\">:<\/span> <span class=\"token builtin\">number<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6808&#xff1a;\u4fdd\u5b58\u62ec\u53f7\u5916\u7684\u8ba1\u7b97\u72b6\u6001&#xff08;\u7ed3\u679c&#043;\u7b26\u53f7&#xff09;<\/span><br \/>\n<span class=\"token keyword\">let<\/span> num <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4e34\u65f6\u53d8\u91cf&#xff1a;\u62fc\u63a5\u591a\u4f4d\u6570&#xff08;\u5982&#034;123&#034;&#xff0c;\u5148\u7b971&#xff0c;\u518d12&#xff0c;\u6700\u540e123&#xff09;<\/span><br \/>\n<span class=\"token keyword\">let<\/span> sign <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7b26\u53f7\u53d8\u91cf&#xff1a;\u8bb0\u5f55\u5f53\u524d\u6570\u5b57\u7684\u7b26\u53f7&#xff08;\u9ed8\u8ba4&#043;&#xff0c;\u56e0\u4e3a\u7b2c\u4e00\u4e2a\u6570\u5b57\u9690\u542b\u6b63\u53f7&#xff09;<\/span><br \/>\n<span class=\"token keyword\">let<\/span> result <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7ed3\u679c\u53d8\u91cf&#xff1a;\u8bb0\u5f55\u5f53\u524d\u5c42\u7ea7&#xff08;\u62ec\u53f7\u5185\/\u5916&#xff09;\u7684\u8ba1\u7b97\u7ed3\u679c<\/span><\/p>\n<p>\u8fd9\u91cc\u6709\u4e2a\u5c0f\u7ec6\u8282&#xff1a;sign \u8bb0\u5f55\u7684\u662f\u300c\u5f53\u524d\u6570\u5b57\u7684\u7b26\u53f7\u300d&#xff0c;\u800c\u4e0d\u662f\u300c\u4e0a\u4e00\u4e2a\u8fd0\u7b97\u7b26\u300d&#xff0c;\u8fd9\u6837\u5904\u7406\u80fd\u66f4\u65b9\u4fbf\u5730\u5bf9\u63a5\u591a\u4f4d\u6570\u89e3\u6790\u548c\u62ec\u53f7\u903b\u8f91&#xff0c;\u540e\u9762\u4f1a\u770b\u5230\u5177\u4f53\u4f5c\u7528\u3002<\/p>\n<h4>2. \u904d\u5386\u5b57\u7b26\u4e32&#xff08;\u6838\u5fc3\u5faa\u73af&#xff09;<\/h4>\n<p>\u5faa\u73af\u7684\u6838\u5fc3\u662f\u300c\u9010\u4e2a\u5904\u7406\u5b57\u7b26\u300d&#xff0c;\u6839\u636e\u5b57\u7b26\u7684\u7c7b\u578b&#xff08;\u6570\u5b57\u3001\u5de6\u62ec\u53f7\u3001\u53f3\u62ec\u53f7\u3001\u8fd0\u7b97\u7b26\u3001\u7a7a\u683c&#xff09;&#xff0c;\u6267\u884c\u4e0d\u540c\u7684\u903b\u8f91&#xff0c;\u6211\u4eec\u9010\u4e2a\u573a\u666f\u5206\u6790&#xff1a;<\/p>\n<h5>\u573a\u666f1&#xff1a;\u89e3\u6790\u591a\u4f4d\u6570&#xff08;\u5b57\u7b26\u662f 0-9&#xff09;<\/h5>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token string\">&#039;0&#039;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> c <span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token string\">&#039;9&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  num <span class=\"token operator\">&#061;<\/span> num <span class=\"token operator\">*<\/span> <span class=\"token number\">10<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">.<\/span><span class=\"token function\">charCodeAt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token string\">&#039;0&#039;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">charCodeAt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u884c\u4ee3\u7801\u662f\u300c\u591a\u4f4d\u6570\u62fc\u63a5\u300d\u7684\u5173\u952e&#xff0c;\u4e3e\u4e2a\u4f8b\u5b50&#xff1a;\u89e3\u6790 \u201c123\u201d \u65f6&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u9047\u5230 \u20181\u2019&#xff1a;num &#061; 0 * 10 &#043; (49 &#8211; 48) &#061; 1&#xff08;\u5b57\u7b26 \u20180\u2019 \u7684 ASCII \u7801\u662f 48&#xff0c;\u20181\u2019 \u662f 49&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9047\u5230 \u20182\u2019&#xff1a;num &#061; 1 * 10 &#043; (50 &#8211; 48) &#061; 12&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9047\u5230 \u20183\u2019&#xff1a;num &#061; 12 * 10 &#043; (51 &#8211; 48) &#061; 123&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u591a\u4f4d\u6570\u7684\u6b63\u786e\u62fc\u63a5&#xff0c;\u907f\u514d\u628a \u201c123\u201d \u89e3\u6790\u6210 1\u30012\u30013 \u4e09\u4e2a\u5355\u72ec\u7684\u6570\u5b57\u3002<\/p>\n<h5>\u573a\u666f2&#xff1a;\u5904\u7406\u5de6\u62ec\u53f7 \u2018(\u2019<\/h5>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;(&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4fdd\u5b58\u62ec\u53f7\u5916\u7684\u7ed3\u679c<\/span><br \/>\n  stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>sign <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">?<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">:<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u4fdd\u5b58\u62ec\u53f7\u524d\u7684\u7b26\u53f7&#xff08;\u75281\/-1\u4ee3\u66ff&#043;\/-&#xff09;<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u91cd\u7f6e\u72b6\u6001&#xff0c;\u5f00\u59cb\u8ba1\u7b97\u62ec\u53f7\u5185\u7684\u5b50\u8868\u8fbe\u5f0f<\/span><br \/>\n  result <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  sign <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u662f\u62ec\u53f7\u5904\u7406\u7684\u6838\u5fc3\u6b65\u9aa4\u4e4b\u4e00&#xff0c;\u76ee\u7684\u662f\u300c\u6682\u5b58\u62ec\u53f7\u5916\u7684\u4e0a\u4e0b\u6587\u300d&#xff0c;\u4e3e\u4e2a\u4f8b\u5b50&#xff1a;\u5f53\u9047\u5230\u8868\u8fbe\u5f0f \u201c(1 &#043; 2) &#8211; 3\u201d \u4e2d\u7684 \u2018(\u2019 \u65f6&#xff1a;<\/p>\n<li>\n<p>\u6b64\u65f6 result &#061; 0&#xff08;\u62ec\u53f7\u5916\u8fd8\u6ca1\u8ba1\u7b97&#xff09;&#xff0c;sign &#061; \u2018&#043;\u2019&#xff08;\u62ec\u53f7\u524d\u662f\u6b63\u53f7&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u628a result&#xff08;0&#xff09;\u538b\u5165\u6808&#xff0c;\u518d\u628a sign \u8f6c\u6362\u6210 1&#xff08;\u2018&#043;\u2019 \u5bf9\u5e94 1&#xff0c;\u2018-\u2019 \u5bf9\u5e94 -1&#xff09;\u538b\u5165\u6808&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u91cd\u7f6e result &#061; 0\u3001sign &#061; \u2018&#043;\u2019&#xff0c;\u5f00\u59cb\u4e13\u6ce8\u8ba1\u7b97\u62ec\u53f7\u5185\u7684 \u201c1 &#043; 2\u201d\u3002<\/p>\n<\/li>\n<p>\u4e3a\u4ec0\u4e48\u7528 1\/-1 \u4ee3\u66ff \u2018&#043;\u2019\/\u2018-\u2019&#xff1f;\u56e0\u4e3a\u540e\u7eed\u5408\u5e76\u62ec\u53f7\u5185\u5916\u7ed3\u679c\u65f6&#xff0c;\u76f4\u63a5\u7528\u300c\u62ec\u53f7\u5916\u7ed3\u679c &#043; \u62ec\u53f7\u524d\u7b26\u53f7 \u00d7 \u62ec\u53f7\u5185\u7ed3\u679c\u300d\u5c31\u80fd\u5feb\u901f\u8ba1\u7b97&#xff0c;\u65e0\u9700\u518d\u5224\u65ad\u7b26\u53f7\u5b57\u7b26\u4e32&#xff0c;\u66f4\u7b80\u6d01\u3002<\/p>\n<h5>\u573a\u666f3&#xff1a;\u5904\u7406\u8fd0\u7b97\u7b26&#xff08;&#043;\/-&#xff09;\u3001\u53f3\u62ec\u53f7 \u2018)\u2019 \u6216\u5b57\u7b26\u4e32\u672b\u5c3e<\/h5>\n<p>\u8fd9\u90e8\u5206\u662f\u300c\u7ed3\u7b97\u5f53\u524d\u6570\u5b57\u300d\u7684\u6838\u5fc3&#xff0c;\u5f53\u9047\u5230\u4ee5\u4e0b\u4e09\u79cd\u60c5\u51b5\u65f6&#xff0c;\u8bf4\u660e\u5f53\u524d\u6570\u5b57\u5df2\u7ecf\u89e3\u6790\u5b8c\u6210&#xff0c;\u9700\u8981\u628a\u5b83\u52a0\u5230 result \u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u9047\u5230\u8fd0\u7b97\u7b26 \u2018&#043;\u2019 \u6216 \u2018-\u2019&#xff08;\u4e0b\u4e00\u4e2a\u6570\u5b57\u8981\u5f00\u59cb\u89e3\u6790&#xff0c;\u5f53\u524d\u6570\u5b57\u9700\u8981\u7ed3\u7b97&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9047\u5230\u53f3\u62ec\u53f7 \u2018)\u2019&#xff08;\u62ec\u53f7\u5185\u7684\u6570\u5b57\u89e3\u6790\u5b8c\u6210&#xff0c;\u9700\u8981\u7ed3\u7b97\u540e\u548c\u62ec\u53f7\u5916\u5408\u5e76&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u904d\u5386\u5230\u5b57\u7b26\u4e32\u672b\u5c3e&#xff08;\u6700\u540e\u4e00\u4e2a\u6570\u5b57\u6ca1\u6709\u540e\u7eed\u8fd0\u7b97\u7b26&#xff0c;\u9700\u8981\u7ed3\u7b97&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;-&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">||<\/span> i <span class=\"token operator\">&#061;&#061;&#061;<\/span> s<span class=\"token punctuation\">.<\/span>length <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;)&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u6b65\u9aa41&#xff1a;\u6839\u636e\u5f53\u524d\u7b26\u53f7&#xff0c;\u628a\u6570\u5b57\u52a0\u5230\u7ed3\u679c\u4e2d<\/span><br \/>\n  result <span class=\"token operator\">&#043;&#061;<\/span> sign <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">?<\/span> num <span class=\"token operator\">:<\/span> <span class=\"token operator\">&#8211;<\/span>num<span class=\"token punctuation\">;<\/span><br \/>\n  num <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u91cd\u7f6e\u4e34\u65f6\u6570\u5b57&#xff0c;\u51c6\u5907\u89e3\u6790\u4e0b\u4e00\u4e2a\u6570<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u6b65\u9aa42&#xff1a;\u66f4\u65b0\u7b26\u53f7&#xff08;\u4ec5\u5f53\u5f53\u524d\u5b57\u7b26\u662f&#043;\/-\u65f6&#xff09;<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;&#043;&#039;<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;-&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    sign <span class=\"token operator\">&#061;<\/span> c<span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u6b65\u9aa43&#xff1a;\u5904\u7406\u53f3\u62ec\u53f7&#xff0c;\u5408\u5e76\u62ec\u53f7\u5185\u5916\u7ed3\u679c<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>c <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token string\">&#039;)&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> prevSign <span class=\"token operator\">&#061;<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">!<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5f39\u51fa\u62ec\u53f7\u524d\u7684\u7b26\u53f7&#xff08;1\/-1&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> prevResult <span class=\"token operator\">&#061;<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">!<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5f39\u51fa\u62ec\u53f7\u5916\u7684\u7ed3\u679c<\/span><br \/>\n    result <span class=\"token operator\">&#061;<\/span> prevResult <span class=\"token operator\">&#043;<\/span> prevSign <span class=\"token operator\">*<\/span> result<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5408\u5e76\u7ed3\u679c<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6211\u4eec\u5206\u6b65\u9aa4\u62c6\u89e3\u8fd9\u90e8\u5206\u903b\u8f91&#xff0c;\u8fd8\u662f\u7528\u4f8b\u5b50\u8f85\u52a9\u7406\u89e3&#xff1a;<\/p>\n<p>\u4f8b\u5b501&#xff1a;\u89e3\u6790 \u201c1 &#043; 2\u201d \u65f6&#xff0c;\u9047\u5230 \u2018&#043;\u2019 \u8fd0\u7b97\u7b26&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6b64\u65f6 num &#061; 1&#xff08;\u5df2\u7ecf\u89e3\u6790\u5b8c\u7b2c\u4e00\u4e2a\u6570\u5b57&#xff09;&#xff0c;sign &#061; \u2018&#043;\u2019&#xff1b;<\/p>\n<\/li>\n<li>\n<p>result &#043;&#061; 1 \u2192 result &#061; 1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>num \u91cd\u7f6e\u4e3a 0&#xff0c;sign \u66f4\u65b0\u4e3a \u2018&#043;\u2019&#xff08;\u5f53\u524d\u8fd0\u7b97\u7b26&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7ee7\u7eed\u89e3\u6790\u4e0b\u4e00\u4e2a\u6570\u5b57 2&#xff0c;\u540e\u7eed\u9047\u5230\u5b57\u7b26\u4e32\u672b\u5c3e\u65f6&#xff0c;\u518d\u628a 2 \u52a0\u5230 result \u4e2d&#xff0c;\u6700\u7ec8 result &#061; 3\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4f8b\u5b502&#xff1a;\u89e3\u6790 \u201c(1 &#043; 2) &#8211; 3\u201d \u65f6&#xff0c;\u9047\u5230 \u2018)\u2019 \u53f3\u62ec\u53f7&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u62ec\u53f7\u5185\u5df2\u7ecf\u89e3\u6790\u5b8c \u201c1 &#043; 2\u201d&#xff0c;\u6b64\u65f6 result &#061; 3&#xff0c;num &#061; 0&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f39\u51fa\u6808\u9876\u7684 prevSign &#061; 1&#xff08;\u62ec\u53f7\u524d\u662f\u6b63\u53f7&#xff09;&#xff0c;\u518d\u5f39\u51fa prevResult &#061; 0&#xff08;\u62ec\u53f7\u5916\u7684\u7ed3\u679c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5408\u5e76\u7ed3\u679c&#xff1a;result &#061; 0 &#043; 1 \u00d7 3 &#061; 3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7ee7\u7eed\u89e3\u6790\u540e\u7eed\u7684 \u2018-\u2019 \u548c 3&#xff0c;\u6700\u7ec8 result &#061; 3 &#8211; 3 &#061; 0\u3002<\/p>\n<\/li>\n<\/ul>\n<h5>\u573a\u666f4&#xff1a;\u5904\u7406\u7a7a\u683c&#xff08;\u76f4\u63a5\u8df3\u8fc7&#xff09;<\/h5>\n<p>\u4ee3\u7801\u4e2d\u6ca1\u6709\u4e13\u95e8\u5199\u7a7a\u683c\u7684\u5904\u7406\u903b\u8f91&#xff0c;\u56e0\u4e3a\u5f53 c \u662f\u7a7a\u683c\u65f6&#xff0c;\u4e0d\u6ee1\u8db3\u4efb\u4f55\u4e00\u4e2a if \u6761\u4ef6&#xff0c;\u4f1a\u76f4\u63a5\u8fdb\u5165\u4e0b\u4e00\u6b21\u5faa\u73af&#xff0c;\u76f8\u5f53\u4e8e\u300c\u81ea\u52a8\u8df3\u8fc7\u300d&#xff0c;\u903b\u8f91\u7b80\u6d01\u9ad8\u6548\u3002<\/p>\n<h4>3. \u6700\u7ec8\u8fd4\u56de\u7ed3\u679c<\/h4>\n<p>\u5faa\u73af\u7ed3\u675f\u540e&#xff0c;result \u4e2d\u5c31\u4fdd\u5b58\u4e86\u6574\u4e2a\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c&#xff0c;\u76f4\u63a5\u8fd4\u56de\u5373\u53ef&#xff1a;return result;<\/p>\n<h3>\u4e94\u3001\u603b\u7ed3\u4e0e\u4f18\u5316\u601d\u8003<\/h3>\n<h4>1. \u6838\u5fc3\u77e5\u8bc6\u70b9\u56de\u987e<\/h4>\n<p>\u8fd9\u9053\u9898\u7684\u6838\u5fc3\u662f\u300c\u6808\u7684\u5e94\u7528\u300d&#xff0c;\u7528\u6808\u6682\u5b58\u62ec\u53f7\u5916\u7684\u4e0a\u4e0b\u6587&#xff0c;\u89e3\u51b3\u62ec\u53f7\u4f18\u5148\u7ea7\u95ee\u9898&#xff0c;\u540c\u65f6\u7528\u4e09\u4e2a\u53d8\u91cf&#xff08;num\u3001sign\u3001result&#xff09;\u7ef4\u62a4\u5f53\u524d\u8ba1\u7b97\u72b6\u6001&#xff0c;\u9ad8\u6548\u89e3\u6790\u591a\u4f4d\u6570\u548c\u7b26\u53f7\u3002<\/p>\n<p>\u5173\u952e\u4eae\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7528 1\/-1 \u4ee3\u66ff \u2018&#043;\u2019\/\u2018-\u2019 \u7b26\u53f7&#xff0c;\u7b80\u5316\u62ec\u53f7\u5185\u5916\u7ed3\u679c\u7684\u5408\u5e76\u903b\u8f91&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e00\u6b21\u904d\u5386\u5b8c\u6210\u6240\u6709\u89e3\u6790\u548c\u8ba1\u7b97&#xff0c;\u65f6\u95f4\u590d\u6742\u5ea6 O(n)&#xff08;n \u662f\u5b57\u7b26\u4e32\u957f\u5ea6&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6808\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u6700\u574f O(n)&#xff08;\u5d4c\u5957\u62ec\u53f7\u5c42\u6570\u6700\u591a\u4e3a n\/2&#xff09;&#xff0c;\u5c5e\u4e8e\u6700\u4f18\u89e3\u6cd5\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u4f18\u5316\u65b9\u5411&#xff08;\u53ef\u9009&#xff09;<\/h4>\n<p>\u5982\u679c\u60f3\u8fdb\u4e00\u6b65\u4f18\u5316\u4ee3\u7801&#xff0c;\u53ef\u4ee5\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5148\u8fc7\u6ee4\u6389\u6240\u6709\u7a7a\u683c&#xff0c;\u51cf\u5c11\u5faa\u73af\u4e2d\u7684\u5224\u65ad&#xff08;\u4f46\u4f1a\u589e\u52a0\u4e00\u6b21\u6b63\u5219\u904d\u5386&#xff0c;\u6574\u4f53\u6548\u7387\u5f71\u54cd\u4e0d\u5927&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u4e8e\u5d4c\u5957\u62ec\u53f7\u6781\u6df1\u7684\u573a\u666f&#xff0c;\u6808\u7684\u7a7a\u95f4\u5f00\u9500\u65e0\u6cd5\u907f\u514d&#xff0c;\u8fd9\u662f\u8be5\u601d\u8def\u7684\u56fa\u6709\u7279\u6027&#xff0c;\u4e5f\u662f\u6700\u4f18\u9009\u62e9\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>3. \u5237\u9898\u542f\u793a<\/h4>\n<p>\u9047\u5230\u300c\u4f18\u5148\u7ea7\u5904\u7406\u300d\u300c\u4e0a\u4e0b\u6587\u6682\u5b58\u300d\u7c7b\u7684\u7b97\u6cd5\u9898&#xff0c;\u4f18\u5148\u8003\u8651\u6808\u8fd9\u79cd\u6570\u636e\u7ed3\u6784&#xff08;\u6bd4\u5982\u62ec\u53f7\u5339\u914d\u3001\u8868\u8fbe\u5f0f\u6c42\u503c\u7b49&#xff09;\u3002\u8fd9\u9053\u9898\u867d\u7136\u662f\u4e2d\u7b49\u96be\u5ea6&#xff0c;\u4f46\u8986\u76d6\u4e86\u6808\u7684\u6838\u5fc3\u7528\u6cd5\u3001\u591a\u4f4d\u6570\u89e3\u6790\u3001\u7b26\u53f7\u5904\u7406\u7b49\u591a\u4e2a\u7ec6\u8282&#xff0c;\u5403\u900f\u8fd9\u9053\u9898&#xff0c;\u80fd\u8f7b\u677e\u5e94\u5bf9\u540c\u7c7b\u7684\u8868\u8fbe\u5f0f\u6c42\u503c\u95ee\u9898&#xff08;\u5982 LeetCode 227. \u57fa\u672c\u8ba1\u7b97\u5668 II&#xff0c;\u652f\u6301\u4e58\u9664\u8fd0\u7b97&#xff09;\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LeetCode \u4e0a\u7684\u7ecf\u5178\u6808\u5e94\u7528\u9898\u2014\u2014224. \u57fa\u672c\u8ba1\u7b97\u5668&#xff0c;\u8fd9\u9053\u9898\u7684\u6838\u5fc3\u662f\u5b9e\u73b0\u4e00\u4e2a\u652f\u6301 \u52a0\u51cf\u8fd0\u7b97\u3001\u62ec\u53f7\u3001\u7a7a\u683c \u7684\u7b80\u6613\u8ba1\u7b97\u5668&#xff0c;\u5e76\u4e14\u660e\u786e\u7981\u6b62\u4f7f\u7528 eval() \u7b49\u5185\u7f6e\u8868\u8fbe\u5f0f\u8ba1\u7b97\u51fd\u6570&#xff0c;\u5b8c\u5168\u9700\u8981\u6211\u4eec\u624b\u52a8\u89e3\u6790\u5b57\u7b26\u4e32\u3001\u5904\u7406\u8fd0\u7b97\u903b\u8f91\u3002<br \/>\n\u5f88\u591a\u540c\u5b66\u9047\u5230\u8fd9\u9053\u9898\u4f1a\u5934\u75bc&#xff0c;\u5c24\u5176\u662f\u62ec\u53f7\u5e26\u6765\u7684\u8fd0\u7b97\u4f18\u5148\u7ea7\u95ee\u9898&#xff0c;\u4eca\u5929\u5c31\u7ed3\u5408\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801&#xff0c;\u4ece\u9898\u76ee\u7406\u89e3\u5230\u4ee3\u7801\u62c6\u89e3&#xff0c;\u4e00\u6b65\u6b65\u8bb2\u6e05\u695a\u6bcf\u4e00\u6b65\u7684\u903b\u8f91&#xff0c;\u65b0\u624b\u4e5f\u80fd\u8f7b\u677e<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2692,568,87,427],"topic":[],"class_list":["post-75641","post","type-post","status-publish","format-standard","hentry","category-server","tag-leetcode","tag-typescript","tag-87","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/75641.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"LeetCode \u4e0a\u7684\u7ecf\u5178\u6808\u5e94\u7528\u9898\u2014\u2014224. \u57fa\u672c\u8ba1\u7b97\u5668&#xff0c;\u8fd9\u9053\u9898\u7684\u6838\u5fc3\u662f\u5b9e\u73b0\u4e00\u4e2a\u652f\u6301 \u52a0\u51cf\u8fd0\u7b97\u3001\u62ec\u53f7\u3001\u7a7a\u683c \u7684\u7b80\u6613\u8ba1\u7b97\u5668&#xff0c;\u5e76\u4e14\u660e\u786e\u7981\u6b62\u4f7f\u7528 eval() \u7b49\u5185\u7f6e\u8868\u8fbe\u5f0f\u8ba1\u7b97\u51fd\u6570&#xff0c;\u5b8c\u5168\u9700\u8981\u6211\u4eec\u624b\u52a8\u89e3\u6790\u5b57\u7b26\u4e32\u3001\u5904\u7406\u8fd0\u7b97\u903b\u8f91\u3002 \u5f88\u591a\u540c\u5b66\u9047\u5230\u8fd9\u9053\u9898\u4f1a\u5934\u75bc&#xff0c;\u5c24\u5176\u662f\u62ec\u53f7\u5e26\u6765\u7684\u8fd0\u7b97\u4f18\u5148\u7ea7\u95ee\u9898&#xff0c;\u4eca\u5929\u5c31\u7ed3\u5408\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801&#xff0c;\u4ece\u9898\u76ee\u7406\u89e3\u5230\u4ee3\u7801\u62c6\u89e3&#xff0c;\u4e00\u6b65\u6b65\u8bb2\u6e05\u695a\u6bcf\u4e00\u6b65\u7684\u903b\u8f91&#xff0c;\u65b0\u624b\u4e5f\u80fd\u8f7b\u677e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/75641.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-12T12:49:32+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75641.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/75641.html\",\"name\":\"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-12T12:49:32+00:00\",\"dateModified\":\"2026-02-12T12:49:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/75641.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/75641.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75641.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/75641.html","og_locale":"zh_CN","og_type":"article","og_title":"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"LeetCode \u4e0a\u7684\u7ecf\u5178\u6808\u5e94\u7528\u9898\u2014\u2014224. \u57fa\u672c\u8ba1\u7b97\u5668&#xff0c;\u8fd9\u9053\u9898\u7684\u6838\u5fc3\u662f\u5b9e\u73b0\u4e00\u4e2a\u652f\u6301 \u52a0\u51cf\u8fd0\u7b97\u3001\u62ec\u53f7\u3001\u7a7a\u683c \u7684\u7b80\u6613\u8ba1\u7b97\u5668&#xff0c;\u5e76\u4e14\u660e\u786e\u7981\u6b62\u4f7f\u7528 eval() \u7b49\u5185\u7f6e\u8868\u8fbe\u5f0f\u8ba1\u7b97\u51fd\u6570&#xff0c;\u5b8c\u5168\u9700\u8981\u6211\u4eec\u624b\u52a8\u89e3\u6790\u5b57\u7b26\u4e32\u3001\u5904\u7406\u8fd0\u7b97\u903b\u8f91\u3002 \u5f88\u591a\u540c\u5b66\u9047\u5230\u8fd9\u9053\u9898\u4f1a\u5934\u75bc&#xff0c;\u5c24\u5176\u662f\u62ec\u53f7\u5e26\u6765\u7684\u8fd0\u7b97\u4f18\u5148\u7ea7\u95ee\u9898&#xff0c;\u4eca\u5929\u5c31\u7ed3\u5408\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801&#xff0c;\u4ece\u9898\u76ee\u7406\u89e3\u5230\u4ee3\u7801\u62c6\u89e3&#xff0c;\u4e00\u6b65\u6b65\u8bb2\u6e05\u695a\u6bcf\u4e00\u6b65\u7684\u903b\u8f91&#xff0c;\u65b0\u624b\u4e5f\u80fd\u8f7b\u677e","og_url":"https:\/\/www.wsisp.com\/helps\/75641.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-12T12:49:32+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/75641.html","url":"https:\/\/www.wsisp.com\/helps\/75641.html","name":"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-12T12:49:32+00:00","dateModified":"2026-02-12T12:49:32+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/75641.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/75641.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/75641.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LeetCode 224. \u57fa\u672c\u8ba1\u7b97\u5668\uff1a\u624b\u5199\u5b9e\u73b0\u52a0\u51cf+\u62ec\u53f7\u8fd0\u7b97"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=75641"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75641\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=75641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=75641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=75641"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=75641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}