Back to course home
0% completed
Vote For New Content
Solution: Reverse Words in a String II
Problem Statement
Given a character array s
, return the updated array after reversing the order of words
in the array.
A word is defined as a sequence of non-space characters
, and the words are separated by one space
character. The input array does not contain any leading or trailing spaces, and the words are always separated by a single space
.
Note: Your code must solve the problem without using any extra space.
Examples
- Example 1:
- Input:
["h","e","l","l","o"," ","w","o","r","l","d"]
- Expected Output:
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page