NeetCode #195LC-2109MediumTwo Pointers
← Back to All Problems

#195 · #2109 · Adding Spaces to a String(向字符串添加空格)

📌 Problem Statement & Constraints

You are given a 0-indexed string s and a 0-indexed integer array spaces listing the indices at which spaces should be inserted. Return the resulting string. The indices are strictly increasing. Constraints: 1 <= s.length <= 3 * 10^5, 0 <= spaces[i] < s.length.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!