mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-29 13:23:09 +08:00
build
This commit is contained in:
@ -305,7 +305,7 @@ comments: true
|
||||
val list = mutableListOf<Int>()
|
||||
while (queue.isNotEmpty()) {
|
||||
val node = queue.poll() // 隊列出隊
|
||||
list.add(node?._val!!) // 儲存節點值
|
||||
list.add(node?._val!!) // 儲存節點值
|
||||
if (node.left != null)
|
||||
queue.offer(node.left) // 左子節點入列
|
||||
if (node.right != null)
|
||||
|
Reference in New Issue
Block a user