Skip to content

Latest commit

 

History

History
 
 

reverseWordsInString

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Problem

Given an input string, reverse the string word by word.

For example,
Given s = "the sky is blue",
return "blue is sky the".

Solution

Soluton 1. Split by regex, then rearrange and concat into sentence

Soluton 2. Reverse the sentence by character, then reverse each word by character