# 0186-reverse-words-in-a-string-ii Try it on leetcode ## Description

Given a character array s, reverse the order of the words.

A word is defined as a sequence of non-space characters. The words in s will be separated by a single space.

Your code must solve the problem in-place, i.e. without allocating extra space.

 

Example 1:

Input: s = ["t","h","e"," ","s","k","y"," ","i","s"," ","b","l","u","e"]
Output: ["b","l","u","e"," ","i","s"," ","s","k","y"," ","t","h","e"]

Example 2:

Input: s = ["a"]
Output: ["a"]

 

Constraints:

## Solution(Python) ```Python class Solution: def reverseWords(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ if s is None: return s.reverse() n = len(s) i = 0 j = 0 while i< n and j