Longest identical block in two data streams
Two capture files record raw message bytes from a feed handler. To find where they last agreed byte-for-byte, you want the longest common substring: the longest contiguous block that appears in both, unlike a subsequence, gaps are not allowed.
a = "ABCDGH", b = "ACDGHR"
-> 4 # "CDGH" is contiguous in both
Return the length of the longest common substring. Target time.
Show a hint
Subsequence DP carries the best answer forward even across a mismatch. Contiguity forbids that: one mismatched character has to reset the run to zero.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.