← ALL NOTES
LeetCode

2109. Adding Spaces to a String

Given a string s and a sorted array spaces of indices, insert a space before each character at an index in spaces, and return the new string. One pass over s with a single pointer walking spaces.

Loading…