Back to problems

Word Compression

Algorithm · Rubrik · Medium

Problem Statement You are given two strings s1 and s2. Your task is to compute the length of the longest common substring between them, with one special rule: If one of the strings is a subsequence of the other, then that entire string is considered a valid common substring (even though it may not appear contiguously in the other string). A substring is a contiguous sequence of characters within a string. A subsequence is a sequence that can be derived by deleting some…

Checking your access…