FastPrepReverse a String
Problems/Reverse a String

Reverse a String

Bank of America logoBank of America● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported by a Bank of America candidate in the second of three rounds, a technical interview. One of the tasks was to write a function that returns a given string reversed.

The report names only the task. Here, the string has up to 10,000 characters: letters, digits, spaces and a few punctuation marks, all of which are reversed too.

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

Given a string s, return the string made of the same characters in the opposite order. The last character of s becomes the first character of the result, and the first character becomes the last.

Spaces, digits and punctuation count as characters too, and each letter keeps its case.

Function

reverseString(s: String) → String

Examples

Example 1

s = "spring 2021"return = "1202 gnirps"

The last character, 1, now comes first, and the first character, s, now comes last. The space still sits between g and 2, which have swapped sides.

Example 2

s = "Ok, go!"return = "!og ,kO"

The string has 7 characters. The comma and the exclamation mark move like any other character. The space is the middle character, so it stays where it is. O stays upper case.

Example 3

s = "A-1"return = "1-A"

The hyphen stays in the middle, and A and 1 trade places.

Constraints

  • 1 <= s.length <= 10^4
  • s consists of English letters, digits, spaces and the characters . , ! ? -

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
  • Reverse Each Word in a SentenceONSITE 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

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 reverseString(String s) {
        // write your code here
    }
}
Checking account…