Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LCS implementation in Ruby (#2252) #2766

Merged
merged 1 commit into from
Apr 25, 2020

Conversation

Tahanima
Copy link
Contributor

@Tahanima Tahanima commented Apr 17, 2020

Fixes #2252

Checklist:

  • 4 space indentation.
  • Coding conventions are followed.
  • Input is taken dynamically.
  • Sample Input / Output is added at the end of file.
  • Logic Documentation (Comments).
  • File names are correct.

Changes proposed in this pull request:

  • Added implementation of Longest Common Subsequence in Ruby

Languages Used:

  • Ruby

Files Added:

  • Added Longest_Common_Subsequence.rb under Longeest_Common_Subsequence folder

Thanks!

@Tahanima
Copy link
Contributor Author

Hello @jainaman224

I have implemented LCS algorithm in Ruby. Please review the changes and let me know if I need to add/change something.

Thank You

Copy link
Collaborator

@singh-shreya6 singh-shreya6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add sample input and sample output at end of file.

end

# Driver Code
arr1 = [10, 15, 20, 25, 30, 35, 40]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to take dynamic inputs in Ruby. Please update the code to take dynamic inputs. This requirement is only relaxed for languages like js or php where we have to create forms for dynamic inputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have changed to dynamic input

# The longest common subsequence comprises of elements 10, 25, 30, 40 in the above arrays
# Output:
# Length of Longest Common Subsequence is: 4
puts "Length of Longest Common Subsequence is: #{len}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a blank line at end of file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added blank line

@@ -0,0 +1,40 @@
# Problem Statement- Given two sequences, find
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert these to a single multi line comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted them to a single multi-line comment

Copy link
Collaborator

@singh-shreya6 singh-shreya6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the requested changes and then squash your commits. Rest all looks good.

@singh-shreya6 singh-shreya6 merged commit 3d4de05 into jainaman224:master Apr 25, 2020
Amitsharma45 pushed a commit to Amitsharma45/Algo_Ds_Notes that referenced this pull request May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Longest Common Subsequence
2 participants