BackhardStrings

Sequential Synergy Solution

Problem Statement

Given two sequences of unique symbols, devise a method to identify the longest contiguous or non-contiguous subsequence of symbols common to both.

Example 1
Input
Sequence1: ABCDE, Sequence2: ACD
Output
ACD

Explanation: The longest sequence common to both sequences is ACD.

Example 2
Input
Sequence1: XYZAB, Sequence2: YZAB
Output
YZAB

Explanation: The longest sequence common to both sequences is YZAB.

Constraints

  • Each sequence consists of unique symbols ranging from A to Z and 0 to 9.
  • The sequences can undergo changes, with symbols being added, removed, or modified over time.
  • 0 <= sequence length <= 1000
  • The sequences do not contain duplicate symbols.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free