Grokking Microsoft Coding Interview
Ask Author
Back to course home

0% completed

Solution: Reverse Words in a String II
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

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:

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible