Skip to main content

Salesforce

SalesForce OA 2023 - Reverse ASCII Decoder

Problem Description:

You are given an encoded string that needs to be decoded using the following steps:

  1. Reverse the encoded string.
  2. Convert the numerical representation to ASCII characters:
    • The encoded string consists of numbers that represent ASCII values of characters.
    • Each ASCII value is either for:
      • Uppercase letters (A to Z), with ASCII values ranging from 65 to 90.
      • Lowercase letters (a to z), with ASCII values ranging from 97 to 122.
      • Space, which has an ASCII value of 32.

Your task is to decode the string and return the decoded message.


Input Format:

  • A single string, encoded_string, representing the numerical encoded string.

Output Format:

  • A decoded string after applying the reversal and ASCII conversion steps.

Constraints:

  • The string will only contain digits representing valid ASCII codes (from 32 to 122).

Sample Input:

encoded_string = "23511011501782351112179911801562340161171141148"

Sample Output:

"Truth Always Prevails"

Sample Input:

encoded_string = "79411901794013823121794015117015623511501231019017901123121772311180180110127"

Sample Output:

"Hello My name is Akshay Shamra"