#3794

Reverse String Prefix

newbie · 100 · lc easy +12 · 89.4% accepted · 38 likes · top 99%

Description

Given a string s and a non-negative integer k, return the string formed by reversing the first k characters of s and leaving the remainder unchanged.

Code

1
2
3