FastPrepDecoding String
Problems/Decoding String

Decoding String

Goldman Sachs logoGoldman Sachs● EasyINTERNOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: Jul 17, 2026. The original table explains how "HackerRank" is encoded; it is not a sample function call. The previous example used that walkthrough in the wrong direction and has been corrected. This function receives the final reversed digit string and returns the original text. The judged core task matches the source at about 99%.

A string is encoded using its decimal ASCII values:

  1. Replace each character with its decimal ASCII value.
  2. Concatenate those values without separators.
  3. Reverse the entire sequence of digits.

You are given the final reversed digit string encode. Decode it and return the original text.

To decode the message, reverse encode, read one valid ASCII value at a time, and convert each value back to its character. The only valid characters are:

  • Uppercase letters A through Z, with values 65 through 90.
  • Lowercase letters a through z, with values 97 through 122.
  • The space character, with value 32.

Function

decodingString(encode: String) → String

Complete the function decodingString.

decodingString has the following parameter:

  • String encode: the final reversed ASCII digit string
  • Returns String: the original decoded text

Examples

Example 1

encode = "7010117928411101701997927"return = "HackerRank"

Reverse 7010117928411101701997927 to obtain 7297991071011148297110107.

ASCII value 72 97 99 107 101 114 82 97 110 107
Character H a c k e r R a n k

Reading the characters in order gives HackerRank.

Constraints

  • 1 <= encode.length <= 10^5
  • encode contains only decimal digits.
  • encode is a valid encoding of a non-empty string containing only uppercase letters, lowercase letters, and spaces.

More Goldman Sachs problems

  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · Seen Nov 2026
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public String decodingString(String encode) {
        // write your code here
    }

}
Checking account…