Given a string s and an integer k, reverse the first k characters for every consecutive block of 2k characters in s.
If there are fewer than k characters left, reverse all of them. If there are at least k characters but fewer than 2k characters left, reverse the first k characters and leave the remaining characters as they are.
Return the resulting string.
Note: The input string contains only lowercase English letters.
Constraints:
s.length
s consists of only lowercase English letters.
k
Given a string s and an integer k, reverse the first k characters for every consecutive block of 2k characters in s.
If there are fewer than k characters left, reverse all of them. If there are at least k characters but fewer than 2k characters left, reverse the first k characters and leave the remaining characters as they are.
Return the resulting string.
Note: The input string contains only lowercase English letters.
Constraints:
s.length
s consists of only lowercase English letters.
k