FastPrepReverse Each Word in a Sentence
Problems/Reverse Each Word in a Sentence

Reverse Each Word in a Sentence

Bank of America logoBank of America● EasyNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bank of America software engineering apprentice interview, in the first live technical round. The task was to flip the letters of every word in a sentence while keeping the words in the same order.

The report includes one small example sentence but gives no limits. Here, the sentence has only letters and single spaces, and it is at most 10,000 characters long.

Our version is about 90% the same as the reported question.

Given a sentence s, return a string where the letters of each word are reversed and the words stay in their original order.

Words in s are separated by single spaces.

Function

reverseWords(s: String) → String

Examples

Example 1

s = "Bank of America"return = "knaB fo aciremA"

"Bank" becomes "knaB", "of" becomes "fo", and "America" becomes "aciremA". The words keep their order.

Example 2

s = "Java is fun"return = "avaJ si nuf"

Each word is reversed on its own: "avaJ", "si" and "nuf".

Example 3

s = "a"return = "a"

A one-letter word reads the same in reverse.

Constraints

  • 1 <= s.length <= 10^4
  • s consists of English letters and spaces.
  • s has no leading or trailing spaces and contains at least one word.
  • Words are separated by a single space.

More Bank of America Onsite Interview questions

  • Centered Star PyramidONSITE INTERVIEW · Seen Nov 2025
  • Employees Without a ManagerONSITE INTERVIEW · Seen Nov 2025
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2025
  • N-th Fibonacci NumberONSITE INTERVIEW · Seen Nov 2025
  • Second Highest SalaryONSITE INTERVIEW · Seen Nov 2025
  • Three Numbers That Add Up to a TargetONSITE INTERVIEW · Seen Apr 2025
  • Duplicate RowsONSITE INTERVIEW · Seen Oct 2023
  • Factorial of a NumberONSITE INTERVIEW · Seen Oct 2023
  • Palindrome String CheckONSITE INTERVIEW · Seen Sep 2023
  • Second Largest Element in an ArrayONSITE INTERVIEW · Seen Jun 2023

Similar questions at other companies

  • Longest Spoken PrefixElevenLabs · ONSITE INTERVIEWElevenLabs interview questions
  • Palindrome Check Ignoring SymbolsWalmart · ONSITE INTERVIEWWalmart interview questions
  • Reverse a String Keeping Dashes in PlaceNykaa · ONSITE INTERVIEWNykaa interview questions
  • Reverse Vowels of a StringGoogle · ONSITE INTERVIEWGoogle interview questions
  • Valid Palindrome After NormalizationKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Count Binary SubstringsDocuSign · ONSITE INTERVIEWDocuSign interview questions
  • Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Palindrome Match PercentageApple · ONSITE INTERVIEWApple interview questions
  • Reverse A StringNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Validate a Word AbbreviationSalesforce · ONSITE INTERVIEWSalesforce interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America hiring insights
Saved
class Solution {
    public String reverseWords(String s) {
        // write your code here
    }
}
Checking account…