mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-10 00:09:06 +01:00
chore: split solutions by language
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
078993071a
commit
333866d1bc
131 changed files with 4 additions and 4 deletions
|
@ -169,4 +169,4 @@ int main()
|
|||
assert(test_isPalindrome(std::vector { 1 }));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -13,15 +13,15 @@ class Solution {
|
|||
if (root == null) {
|
||||
return levels
|
||||
}
|
||||
|
||||
|
||||
if (level + 1 > levels.size) {
|
||||
levels.add(mutableListOf<Int>())
|
||||
}
|
||||
|
||||
|
||||
levels[level].add(root.`val`)
|
||||
levelOrder(root.left, levels, level + 1)
|
||||
return levelOrder(root.right, levels, level + 1)
|
||||
}
|
||||
|
||||
|
||||
fun levelOrder(root: TreeNode?): List<List<Int>> = levelOrder(root, mutableListOf<MutableList<Int>>(), 0)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue