Tap here to switch tabs
Problem
Submissions

Problem: Reverse String Prefix

med
30 min
Try to solve the Reverse String Prefix problem.

Statement

Given a string s and an integer k, reverse the prefix of s consisting of the first k characters while leaving the rest of the string unchanged. Return the resulting string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • 1≤1 \leq k ≤\leq s.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reverse String Prefix

med
30 min
Try to solve the Reverse String Prefix problem.

Statement

Given a string s and an integer k, reverse the prefix of s consisting of the first k characters while leaving the rest of the string unchanged. Return the resulting string.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • 1≤1 \leq k ≤\leq s.length