• Customer Support: admin@thealgorists.com
  • Feedback: We are listening to your every feedback, and taking action to constantly improve your learning experience. If you have any feedback, please use this form: https://thealgorists.com/Feedback.
  • If you are a student, email to admin@thealgorists.com to get special student discount.



Problem Statement:

Given two strings find length of the longest common substring.

Solution:

If we keep the template discussed in 2-Strings DP in mind, this problem very easily transforms to: for all substrings in the two given strings, find the Longest Common SUFFIX. Why and How ? If the given two strings are str1 = "hackathoncode" and str2 = "marathonsprint", the longest common substring is "athon" which is the longest common SUFFIX for the substrings "hackathon" and "marathon".

Code:




This is a Premium content. Please subscribe to access the code.
After subscribing please come back and refresh this page.




One of my goals is to make you very comfortable with bottom-up tabulation approach of solving Dynamic Programming. I hope you are getting the hang of it by now.

The above content is written by:

Abhishek Dey

Abhishek Dey

A Visionary Software Engineer With A Mission To Empower Every Person & Every Organization On The Planet To Achieve More

Microsoft | University of Florida

View LinkedIn profile


If you have any feedback, please use this form: https://thealgorists.com/Feedback.




Subscribe to Our Youtube Channel

Follow Us On LinkedIn
wave