From 2b9538d09b0089debdbefc79ebcf727437d9bd4d Mon Sep 17 00:00:00 2001 From: fartem Date: Thu, 12 Dec 2024 09:57:29 +0300 Subject: [PATCH] 2024-12-12 v. 7.3.0: added "606. Construct String from Binary Tree" --- README.md | 2 +- leetcode-ruby.gemspec | 2 +- lib/{easy => medium}/606_construct_string_from_binary_tree.rb | 2 ++ .../test_606_construct_string_from_binary_tree.rb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) rename lib/{easy => medium}/606_construct_string_from_binary_tree.rb (98%) rename test/{easy => medium}/test_606_construct_string_from_binary_tree.rb (91%) diff --git a/README.md b/README.md index 8e9dc04a..70df239a 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,6 @@ Profile on LeetCode: [fartem](https://leetcode.com/fartem/). | 590. N-ary Tree Postorder Traversal | [Link](https://leetcode.com/problems/n-ary-tree-postorder-traversal/) | [Link](./lib/easy/590_n_ary_tree_postorder_traversal.rb) | [Link](./test/easy/test_590_n_ary_tree_postorder_traversal.rb) | | 594. Longest Harmonious Subsequence | [Link](https://leetcode.com/problems/longest-harmonious-subsequence/) | [Link](./lib/easy/594_longest_harmonious_subsequence.rb) | [Link](./test/easy/test_594_longest_harmonious_subsequence.rb) | | 599. Minimum Index Sum of Two Lists | [Link](https://leetcode.com/problems/minimum-index-sum-of-two-lists/) | [Link](./lib/easy/599_minimum_index_sum_of_two_lists.rb) | [Link](./test/easy/test_599_minimum_index_sum_of_two_lists.rb) | -| 606. Construct String from Binary Tree | [Link](https://leetcode.com/problems/construct-string-from-binary-tree/) | [Link](./lib/easy/606_construct_string_from_binary_tree.rb) | [Link](./test/easy/test_606_construct_string_from_binary_tree.rb) | | 617. Merge Two Binary Trees | [Link](https://leetcode.com/problems/merge-two-binary-trees/) | [Link](./lib/easy/617_merge_two_binary_trees.rb) | [Link](./test/easy/test_617_merge_two_binary_trees.rb) | | 628. Maximum Product of Three Numbers | [Link](https://leetcode.com/problems/maximum-product-of-three-numbers/) | [Link](./lib/easy/628_maximum_product_of_three_numbers.rb) | [Link](./test/easy/test_628_maximum_product_of_three_numbers.rb) | | 637. Average of Levels in Binary Tree | [Link](https://leetcode.com/problems/average-of-levels-in-binary-tree/) | [Link](./lib/easy/637_average_of_levels_in_binary_tree.rb) | [Link](./test/easy/test_637_average_of_levels_in_binary_tree.rb) | @@ -595,3 +594,4 @@ Profile on LeetCode: [fartem](https://leetcode.com/fartem/). | 556. Next Greater Element III | [Link](https://leetcode.com/problems/next-greater-element-iii/) | [Link](./lib/medium/556_next_greater_element_iii.rb) | [Link](./test/medium/test_556_next_greater_element_iii.rb) | | 560. Subarray Sum Equals K | [Link](https://leetcode.com/problems/subarray-sum-equals-k/) | [Link](./lib/medium/560_subarray_sum_equals_k.rb) | [Link](./test/medium/test_560_subarray_sum_equals_k.rb) | | 581. Shortest Unsorted Continuous Subarray | [Link](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/) | [Link](./lib/medium/581_shortest_unsorted_continuous_subarray.rb) | [Link](./test/medium/test_581_shortest_unsorted_continuous_subarray.rb) | +| 606. Construct String from Binary Tree | [Link](https://leetcode.com/problems/construct-string-from-binary-tree/) | [Link](./lib/medium/606_construct_string_from_binary_tree.rb) | [Link](./test/medium/test_606_construct_string_from_binary_tree.rb) | diff --git a/leetcode-ruby.gemspec b/leetcode-ruby.gemspec index 4dfbe5bb..48912c2f 100644 --- a/leetcode-ruby.gemspec +++ b/leetcode-ruby.gemspec @@ -5,7 +5,7 @@ require 'English' ::Gem::Specification.new do |s| s.required_ruby_version = '>= 3.0' s.name = 'leetcode-ruby' - s.version = '7.2.9' + s.version = '7.3.0' s.license = 'MIT' s.files = ::Dir['lib/**/*.rb'] + %w[README.md] s.executable = 'leetcode-ruby' diff --git a/lib/easy/606_construct_string_from_binary_tree.rb b/lib/medium/606_construct_string_from_binary_tree.rb similarity index 98% rename from lib/easy/606_construct_string_from_binary_tree.rb rename to lib/medium/606_construct_string_from_binary_tree.rb index 4f942181..ac9f4490 100644 --- a/lib/easy/606_construct_string_from_binary_tree.rb +++ b/lib/medium/606_construct_string_from_binary_tree.rb @@ -10,6 +10,8 @@ def tree2str(root) result.join end +private + # @param {TreeNode} node # @param {String[]} str def tree_to_str(node, str) diff --git a/test/easy/test_606_construct_string_from_binary_tree.rb b/test/medium/test_606_construct_string_from_binary_tree.rb similarity index 91% rename from test/easy/test_606_construct_string_from_binary_tree.rb rename to test/medium/test_606_construct_string_from_binary_tree.rb index 2e81654e..62ebcffd 100644 --- a/test/easy/test_606_construct_string_from_binary_tree.rb +++ b/test/medium/test_606_construct_string_from_binary_tree.rb @@ -2,7 +2,7 @@ require_relative '../test_helper' require_relative '../../lib/common/binary_tree' -require_relative '../../lib/easy/606_construct_string_from_binary_tree' +require_relative '../../lib/medium/606_construct_string_from_binary_tree' require 'minitest/autorun' class ConstructStringFromBinaryTreeTest < ::Minitest::Test