Commit 10ad8c6

mo <mokha@cisco.com>
2017-08-08 20:13:32
remove unneccesary check for leaf.
1 parent 1aee88c
Changed files (1)
spec/binary_trees/kth_largest_in_bst_spec.rb
@@ -118,13 +118,8 @@ describe "#kth_largest_in_bst" do
     all[k + 1]
   end
 
-  def leaf?(tree)
-    tree.left&.nil? && tree.right&.nil?
-  end
-
   def to_array(tree)
     return [] if tree.nil?
-    return [tree.value] if leaf?(tree)
     to_array(tree.left) + [tree.value] + to_array(tree.right)
   end