FastPrepReverse a String
Problems/Reverse a String

Reverse a String

IndiaMART logoIndiaMART● EasyONSITE INTERVIEW
QuestionFunctionExamples

Problem statement

Source note: This problem is backed by a real IndiaMART onsite interview report. The report directly named string reversal, but it did not include the exact function interface, examples, or constraints. The core task match is about 95%.

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

Character case and all non-letter characters must be preserved.

Function

reverseString(s: String) → String

Examples

Example 1

s = "FastPrep"return = "perPtsaF"

Reading the input from right to left produces perPtsaF.

Example 2

s = "hello"return = "olleh"
See IndiaMART hiring insights
Saved
public String reverseString(String s) {
  // write your code here
}
Checking account…