You are given a string s consisting of lowercase English letters and an integer k.
A string t is defined as an ideal string if it satisfies the following conditions:
t is a subsequence of s.
The absolute difference in the alphabetical positions of every two adjacent characters in t is less than or equal to k.
Return the length of the longest ideal string.
Note: A subsequence is a string derived from another string by deleting some or no characters without changing the relative order of the remaining characters.
Constraints:
s.length
k
s consists of lowercase English letters.
You are given a string s consisting of lowercase English letters and an integer k.
A string t is defined as an ideal string if it satisfies the following conditions:
t is a subsequence of s.
The absolute difference in the alphabetical positions of every two adjacent characters in t is less than or equal to k.
Return the length of the longest ideal string.
Note: A subsequence is a string derived from another string by deleting some or no characters without changing the relative order of the remaining characters.
Constraints:
s.length
k
s consists of lowercase English letters.