Reverse String Word Wise Problem Statement

Your task is to reverse the given string word-wise. This means the last word in the string should appear first, the second last word should appear second, and so forth, while keeping each individual word intact.

Example:

Input:
"Hello World from OpenAI"
Output:
"OpenAI from World Hello"
Explanation:

The input string is reversed word wise to become "OpenAI from World Hello".

Constraints:

  • 0 <= |S| <= 10^7, where |S| represents the length of the string S.
AnswerBot
1y

The given string needs to be reversed word wise, keeping the individual words intact.

  • Split the string into an array of words using a space as the delimiter.

  • Reverse the array of words.

  • Join the reversed...read more

Anonymous
9mo
var Name="ADITYA"; for(i=Name.length-1;i>=0;i--) { console.log(Name[i]); }
Help your peers!
Select
Add answer anonymously...

Unthinkable Solutions Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. Given an array of intervals where intervals[i] = [starti, endi], merge all overl...read more
A Software Developer was asked 8mo agoQ. Implement debouncing, create a nodejs server with a get / post api, a puzzle, ja...read more
A Software Developer was asked 8mo agoQ. Designing dbms for a college website

Popular interview questions of Software Developer

A Software Developer was asked 9mo agoQ1. Given an array of intervals where intervals[i] = [starti, endi], merge all overl...read more
A Software Developer was asked 7mo agoQ2. Implement debouncing, create a nodejs server with a get / post api, a puzzle, ja...read more
A Software Developer was asked 7mo agoQ3. Designing dbms for a college website
Unthinkable Solutions Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits