The time complexity of the dynamic programming approach for finding the longest common subsequence is _______.

  • O(2^n)
  • O(n log n)
  • O(n^2)
  • O(nm)
The time complexity of the dynamic programming approach for finding the Longest Common Subsequence (LCS) is O(n^2), where 'n' and 'm' are the lengths of the input strings. This is achieved by filling up a 2D table in a bottom-up manner.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *