Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

Solution: Longest Repeating Subsequence

Problem Statement

Given a sequence, find the length of its longest repeating subsequence (LRS). A repeating subsequence will be the one that appears at least twice in the original sequence and is not overlapping (i.e. none of the corresponding characters in the repeating subsequences have the same index).

Example 1:

Input: <span style="color:blue">"t o m o r r o w"</span>
Output: <span style="color:green">2</span>




Like the course? Get enrolled and start learning!