FastPrepReverse a String
Problems/Reverse a String

Reverse a String

Persistent Systems logoPersistent Systems● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Persistent Systems phone screen. A report names a Reverse String coding question. We reused the function signature, the examples, and the limits from an equivalent task we already reviewed. We think our version is about 95% the same as the reported question.

Given a string s, return a new string containing the same characters in reverse order.

Preserve character case, spaces, digits, and punctuation. An empty input returns an empty string.

Function

reverseString(s: String) → String

Examples

Example 1

s = "FastPrep"return = "perPtsaF"

Reading FastPrep from right to left produces perPtsaF.

Example 2

s = "a b!"return = "!b a"

The punctuation and space remain characters and move to their reversed positions.

Example 3

s = ""return = ""

The reverse of the empty string is the empty string.

Constraints

  • 0 <= s.length <= 200000
  • s contains only printable ASCII characters.

Similar questions at other companies

  • Run-Length Encoding and DecodingAirbnb · PHONE SCREENAirbnb interview questions
  • Check if a String Is a PalindromeCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Reverse a StringAmazon · PHONE SCREEN
  • 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
  • Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Valid Palindrome IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
See Persistent Systems hiring insights
Saved
class Solution {
    public String reverseString(String s) {
      // Write your code here.
    }

}
Checking account…