Bloomberg L.P. Interview Question: How to reverse a string by wo... | Glassdoor

Interview Question

Financial Software Developer Interview New York, NY

How to reverse a string by word like "I love California" to

  "California love I"
technical, algorithm

Interview Answer

1 Answer


If they are looking for an answer using a data structure, use a stack. Assuming it is a high-level language question:
- Separate words by delimiter (be sure to ask what delimiter to use first! Don't assume)
- Push in order onto a stack
- Pop off the stack into a string buffer, or just print

Mikhail on Oct 9, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.