solution.json 1.7 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "6c7ce7b18722435fb30547af551dd756",
  "keywords": "记忆化搜索,数学,动态规划",
  "title": "爬楼梯",
  "desc": [
    {
      "content": "\n<p>假设你正在爬楼梯。需要 <em>n</em>&nbsp;阶你才能到达楼顶。</p><p>每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?</p><p><strong>注意:</strong>给定 <em>n</em> 是一个正整数。</p><p><strong>示例 1:</strong></p><pre><strong>输入:</strong> 2<strong><br />输出:</strong> 2<strong><br />解释:</strong> 有两种方法可以爬到楼顶。1.  1 阶 + 1 阶2.  2 阶</pre><p><strong>示例 2:</strong></p><pre><strong>输入:</strong> 3<strong><br />输出:</strong> 3<strong><br />解释:</strong> 有三种方法可以爬到楼顶。1.  1 阶 + 1 阶 + 1 阶2.  1 阶 + 2 阶3.  2 阶 + 1 阶</pre>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "java"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ]
  ],
  "template": {
    "content": "class Solution {\n\tpublic int climbStairs(int n) {\n\t\tint[] num = new int[n + 1];\n\t\tnum[0] = 1;\n\t\tnum[1] = 1;\n\t\tfor (int i = 2; i <= n; i++) {\n\t\t\tnum[i] = num[i - 1] + num[i - 2];\n\t\t}\n\t\treturn num[n];\n\t}\n}\n",
    "language": "java"
  },
  "node_id": "dailycode-69d51623b58146baa7164733d16a104a",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470125"
}