mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-20 15:30:58 +00:00
Refine kotlin code (#1241)
* style(kotlin): Improve kotlin codes readability. * remove redundant quotes. * style(kotlin): improve codes readability. * style(kotlin): refine kotlin codes. * Create kotlin.yml * Create kotlin.yml * Delete .github/workflows/kotlin * Delete .github/workflows/main.yml * Create kotlin.yml * Update kotlin.yml * Delete .github/workflows/kotlin.yml * Create hello_world_workflow.main.kts * Delete .github/workflows/hello_world_workflow.main.kts * remove empty line
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
package utils
|
||||
|
||||
/* 二叉树节点类 */
|
||||
/* 构造方法 */
|
||||
class TreeNode(
|
||||
var value: Int // 节点值
|
||||
) {
|
||||
@@ -59,8 +60,8 @@ class TreeNode(
|
||||
}
|
||||
|
||||
/* 将二叉树序列化为列表 */
|
||||
fun treeToList(root: TreeNode?): List<Int?> {
|
||||
val res = ArrayList<Int?>()
|
||||
fun treeToList(root: TreeNode?): MutableList<Int?> {
|
||||
val res = mutableListOf<Int?>()
|
||||
treeToListDFS(root, 0, res)
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user