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
problems
cpp
boats-to-save-people.cppcan-place-flowers.cppcount-good-nodes-in-binary-tree.cppcount-ways-to-build-good-strings.cppdesign-parking-system.cppdetermine-if-two-strings-are-close.cppdivide-a-string-into-groups-of-size-k.cppkth-smallest-element-in-a-sorted-matrix.cppmatrix-diagonal-sum.cppmax-sum-of-rectangle-no-larger-than-k.cppmaximum-running-time-of-n-computers.cppmerge-strings-alternately.cppmiddle-of-the-linked-list.cppminimum-moves-to-reach-target-score.cppmirror-reflection.cppmy-calendar-i.cppn-ary-tree-level-order-traversal.cppn-ary-tree-preorder-traversal.cppnumber-of-matching-subsequences.cppnumbers-with-same-consecutive-differences.cppout-of-boundary-paths.cpppalindrome-linked-list.cpppartition-list.cpppascals-triangle-ii.cpppascals-triangle.cppransom-note.cppremoving-stars-from-a-string.cppreordered-power-of-2.cpprotate-image.cppsame-tree.cppsolving-questions-with-brainpower.cppsort-the-matrix-diagonally.cppspiral-matrix-ii.cppspiral-matrix.cppunique-paths.cpputf-8-validation.cppvalid-parentheses.cppvertical-order-traversal-of-a-binary-tree.cpp
cs
java
binary-search-tree-iterator.javacombination-sum-iv.javaconvert-sorted-array-to-binary-search-tree.javaflatten-nested-list-iterator.javan-ary-tree-level-order-traversal.javapeeking-iterator.javarle-iterator.java
js
allow-one-function-call.jsapply-transform-over-each-element-in-array.jsarray-reduce-transformation.jscache-with-time-limit.jscounter-ii.jscounter.jscreate-hello-world-function.jscurry.jsdebounce.jsfilter-elements-from-array.jsfunction-composition.jsmemoize.jspromise-pool.jspromise-time-limit.jssleep.jsthrottle.js
kt
binary-tree-inorder-traversal.ktbinary-tree-level-order-traversal.ktcheck-if-every-row-and-column-contains-all-numbers.ktconstruct-string-from-binary-tree.ktfirst-unique-character-in-a-string.ktiterator-for-combination.ktlowest-common-ancestor-of-a-binary-search-tree.ktmax-area-of-island.ktmaximize-distance-to-closest-person.ktmaximum-units-on-a-truck.ktminimum-number-of-refueling-stops.ktpower-of-three.ktroman-to-integer.ktsplit-array-into-consecutive-subsequences.ktsubstring-with-concatenation-of-all-words.ktunique-morse-code-words.ktvalidate-binary-search-tree.ktword-ladder-ii.kt
rb
binary-search.rbclimbing-stairs.rbcontains-duplicate.rbfibonacci-number.rbfirst-bad-version.rbinsert-into-a-binary-search-tree.rblinked-list-cycle-ii.rbmaximum-subarray.rbmerge-sorted-array.rbmin-cost-climbing-stairs.rbrotate-array.rbsearch-insert-position.rbsquares-of-a-sorted-array.rbtribonacci.rbtwo-sum.rbword-pattern.rb
rs
|
@ -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