Your question is Longest Common Subsequence. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Meta may compare text from Facebook, Instagram, or WhatsApp to identify shared ordered content patterns. Given two strings, return one longest common subsequence, preserving character order while allowing characters to be skipped.
A subsequence does not need to be contiguous. If multiple longest common subsequences exist, return any one of them.
Implement longest_common_subsequence(text1, text2).
text1 and text2 containing lowercase English letters.text1 and text2.def longest_common_subsequence(text1, text2):