Skip to content

Commit

Permalink
code for chapter 9 in ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Rische committed Mar 3, 2016
1 parent 58b026e commit 7a2d6d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 09_dynamic_programming/ruby/01_longest_common_subsequence.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if word_a[i] == word_b[j]
# The letters match.
cell[i][j] = cell[i-1][j-1] + 1
else
# The letters don't match.
cell[i][j] = [cell[i-1][j], cell[i][j-1]].max
end

0 comments on commit 7a2d6d8

Please sign in to comment.