mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-18 11:36:48 +08:00
更新国内版力扣题目描述变更
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
<p>In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom (i.e., each disk sits on top of an even larger one). You have the following constraints:</p>
|
||||
|
||||
<p>(1) Only one disk can be moved at a time.<br />
|
||||
(2) A disk is slid off the top of one tower onto another tower.<br />
|
||||
(3) A disk cannot be placed on top of a smaller disk.</p>
|
||||
|
||||
<p>Write a program to move the disks from the first tower to the last using stacks.</p>
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>: A = [2, 1, 0], B = [], C = []
|
||||
<strong> Output</strong>: C = [2, 1, 0]
|
||||
</pre>
|
||||
|
||||
<p><strong>Example2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>: A = [1, 0], B = [], C = []
|
||||
<strong> Output</strong>: C = [1, 0]
|
||||
</pre>
|
||||
|
||||
<p><strong>Note:</strong></p>
|
||||
|
||||
<ol>
|
||||
<li><code>A.length <= 14</code></li>
|
||||
</ol>
|
||||
<p>In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide onto any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom (i.e., each disk sits on top of an even larger one). You have the following constraints:</p>
|
||||
|
||||
|
||||
|
||||
<p>(1) Only one disk can be moved at a time.<br />
|
||||
|
||||
(2) A disk is slid off the top of one tower onto another tower.<br />
|
||||
|
||||
(3) A disk cannot be placed on top of a smaller disk.</p>
|
||||
|
||||
|
||||
|
||||
<p>Write a program to move the disks from the first tower to the last using stacks.</p>
|
||||
|
||||
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
|
||||
|
||||
<pre>
|
||||
|
||||
<strong> Input</strong>: A = [2, 1, 0], B = [], C = []
|
||||
|
||||
<strong> Output</strong>: C = [2, 1, 0]
|
||||
|
||||
</pre>
|
||||
|
Reference in New Issue
Block a user