ByteDance / TikTok logoByteDance / TikTok
Coding·60 minMembers

Reverse Words in a String (Preserve Spaces, In-Place)

Members only

Reverse the word order in a string. Follow-ups: rewrite to preserve the original number of spaces between every position, and reduce extra space below `O(n)`.

SWE
string
two-pointer
in-memory-database
medium
Frequency
Single report
Last asked
2026-03-10
Stage
onsite-coding

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...