diff options
| author | mo <mokha@cisco.com> | 2017-08-12 13:15:22 -0600 |
|---|---|---|
| committer | mo <mokha@cisco.com> | 2017-08-12 13:15:22 -0600 |
| commit | 6d056cb59bc5a37d597c6bd0eab13b55e4d9ba48 (patch) | |
| tree | d0e2aec76ca5aa868480800c57c1c0493fb9d742 | |
| parent | 94ed4bcc2a737778145d7faa59d8663750e80fc5 (diff) | |
sort the parts.
| -rw-r--r-- | spec/binary_trees/find_substrings_spec.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/binary_trees/find_substrings_spec.rb b/spec/binary_trees/find_substrings_spec.rb index ac50686..a0086b2 100644 --- a/spec/binary_trees/find_substrings_spec.rb +++ b/spec/binary_trees/find_substrings_spec.rb @@ -56,6 +56,7 @@ describe "#find_substrings" do #end def find_substrings(words, parts) + parts = parts.sort { |x, y| y.length <=> x.length } words.map do |word| current = nil length = nil |
