Available question text
Given a string s and integer k, find the longest subsequence where the absolute difference between every two adjacent letters' positions in the alphabet is ≤ k — essentially a variant of longest subsequence solved by dynamic programming over the 26 letters, maintaining for each letter the best length of an ideal subsequence ending there and updating from letters within ±k.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Microsoft
Leetcode 2370. Longest Ideal Subsequence
Reported Jan 26, 2025 · 1 source report
INTERN
Source snapshot: Nov 12, 2026
View source