mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Finetune
This commit is contained in:
@ -28,7 +28,7 @@ function dfs(i, src, buf, tar) {
|
||||
}
|
||||
|
||||
/* 求解汉诺塔 */
|
||||
function solveHanota(A, B, C) {
|
||||
function hanota(A, B, C) {
|
||||
const n = A.length;
|
||||
// 将 A 顶部 n 个圆盘借助 B 移到 C
|
||||
dfs(n, A, B, C);
|
||||
@ -44,7 +44,7 @@ console.log(`A = ${JSON.stringify(A)}`);
|
||||
console.log(`B = ${JSON.stringify(B)}`);
|
||||
console.log(`C = ${JSON.stringify(C)}`);
|
||||
|
||||
solveHanota(A, B, C);
|
||||
hanota(A, B, C);
|
||||
|
||||
console.log('圆盘移动完成后:');
|
||||
console.log(`A = ${JSON.stringify(A)}`);
|
||||
|
||||
Reference in New Issue
Block a user