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 }));
|
assert(test_isPalindrome(std::vector { 1 }));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -13,15 +13,15 @@ class Solution {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
return levels
|
return levels
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level + 1 > levels.size) {
|
if (level + 1 > levels.size) {
|
||||||
levels.add(mutableListOf<Int>())
|
levels.add(mutableListOf<Int>())
|
||||||
}
|
}
|
||||||
|
|
||||||
levels[level].add(root.`val`)
|
levels[level].add(root.`val`)
|
||||||
levelOrder(root.left, levels, level + 1)
|
levelOrder(root.left, levels, level + 1)
|
||||||
return levelOrder(root.right, levels, level + 1)
|
return levelOrder(root.right, levels, level + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun levelOrder(root: TreeNode?): List<List<Int>> = levelOrder(root, mutableListOf<MutableList<Int>>(), 0)
|
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