Practice Longest Subsequence Repeated k Times
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Longest Subsequence Repeated k Times
Problem Statement
You are given a string s of length n, and an integer k. You are tasked to find the longest subsequence repeated k times in string s. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters. A subsequence seq is repeated k times in the string s if seq * k is a subsequence of s, where seq * k represents a string constructed by concatenating seq k times. Return the longest subsequence repeated k times in string s. If multiple such subsequences are found, return the lexicographically largest one. If there is no such subsequence, return an empty string.
Source: Longest Subsequence Repeated k Times on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "letsleetcode", k = 2
"let"
# Example 2
s = "bb", k = 2
"b"
# Example 3
s = "ab", k = 2
""
Constraints
Related LeetCode Problems
Practice more problems similar to Longest Subsequence Repeated k Times.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.