Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Reverse Words in a String
Bookmark
Split & Reverse
Two Pointers
Reverse In Place
Input
Example 1
Example 2 (Spaces)
Example 3 (Multiple Spaces)
Single Word
Custom
s
=
the sky is blue
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
the
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
the
sky
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
the
sky
is
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
the
sky
is
blue
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
blue
is
sky
the
result
b
l
u
e
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
blue
is
sky
the
result
b
l
u
e
␣
i
s
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
blue
is
sky
the
result
b
l
u
e
␣
i
s
␣
s
k
y
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
blue
is
sky
the
result
b
l
u
e
␣
i
s
␣
s
k
y
␣
t
h
e
t
h
e
␣
s
k
y
␣
i
s
␣
b
l
u
e
words
blue
is
sky
the
result
b
l
u
e
␣
i
s
␣
s
k
y
␣
t
h
e
algo
master
.
io
Step:
Start: reverse the word order of "the sky is blue"
0 / 10
Input
Example 1
Example 2 (Spaces)
Example 3 (Multiple Spaces)
Single Word
Custom
s
=
the sky is blue
0 / 10
algo
master
.
io
Step:
Start: reverse the word order of "the sky is blue"