Reverse Words In A String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the output reversed string you need to put a single space between two words, and your reversed string should not co...

read more
CodingNinjas
author
2y
Approach : 1) Create a String ans to store the reversed string.2) Initialize a variable i to 0 and iterate the whole string through a while loop.3) Skip initial spaces by just incrementing i.4) C...
see more
CodingNinjas
author
2y
Brute forceCreate a String ans to store the reversed string.Initialize a variable i to 0 and iterate the whole string through a while loop.Skip initial spaces by just incrementing i.Create a String th...
see more
CodingNinjas
author
2y
Backward TraversalIf the string is null or empty return an empty string.If the string is “ “ then return an empty string.Initialize a String ans to store the reversed string.Initialize a pointer to th...
see more
Add answer anonymously...
JPMorgan Chase & Co. Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter