FastPrepReverse a String
Problems/Reverse a String

Reverse a String

Amazon logoAmazon● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: In the first round of an Amazon senior firmware and BIOS engineer interview, with the hiring manager and a teammate, one coding task was to reverse a string. The report names the task and nothing else.

It gives no examples, input rules or limits, and does not say whether the order of words or of characters was meant. Here, every character is reversed, spaces and digits count as characters, letters keep their case, the answer is returned as a new string, and the limits and examples are ours.

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

Given a string s, return a new string with the characters of s in reverse order: the last character first and the first character last.

Every character counts, including spaces and digits. Letters keep their case, and spaces at either end are kept and move to the other end.

Function

reverseString(s: String) → String

Examples

Example 1

s = "firmware"return = "erawmrif"

Reading firmware from its last character to its first gives erawmrif.

Example 2

s = "Boot v2 ok"return = "ko 2v tooB"

Spaces and digits are characters too and keep their reversed positions. The 10 characters Boot v2 ok read backward give ko 2v tooB. Upper and lower case stay as they are.

Example 3

s = "a"return = "a"

A one-character string reads the same in both directions.

Constraints

  • 1 <= s.length <= 10^4
  • s consists of English letters, digits and spaces.

More Amazon Phone Screen questions

  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 3SumPHONE SCREEN · Seen Nov 2026
  • Circular Primes Below a LimitPHONE SCREEN · Seen Nov 2026
  • Cheapest Flights Within K StopsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Two SumOA · PHONE SCREEN · Seen Nov 2026
  • Count the 1 Bits in a 32-Bit ValuePHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Check if a String Is a PalindromeCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Reverse a String ManuallyNewgen Software · PHONE SCREEN
  • Reverse a String with Two PointersSnowflake · PHONE SCREENSnowflake interview questions
  • Palindrome with One DeletionWhatNot · PHONE SCREENWhatNot interview questions
  • Valid Word AbbreviationMeta · PHONE SCREENMeta interview questions
  • Reverse a StringPersistent Systems · PHONE SCREEN
  • Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Valid Palindrome IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Reverse String In PlaceThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions

Amazon interview experiences

  • Amazon SWE OA with AI Coding: 1 Experience
  • Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon BIE Intern SQL and Interview Questions: 17 Experiences
  • Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
  • Amazon SDE II (L5) Interview Questions: 5 Experiences
See Amazon hiring insights
Saved
class Solution {
    public String reverseString(String s) {
        // Write your code here.
    }
}
Checking account…