Problem · String
Decoding String
Many simple encoding methods have been devised over the years. A common method is the ASCII character set used to display characters on the screen. Each character is given a numeric value which can be interpreted by the computer.
To decode the string, first reverse the string of digits, then successively pick valid values from the string and convert them to their ASCII equivalents. Some of the values will have two digits, and others three. Use the ranges of valid values when decoding the string of digits.
Given a string, decode it following the steps mentioned above.
Complete the function decode.
decode has the following parameter(s):
string encode: an encoded stringReturn
string: the original decoded string decode.
Examples
01 · Example 1
encode = "HackerRank" return = "729799107101114328297110107"
The table above shows the conversion from the string HackerRank to the ASCII string 729799107101114328297110107.
The last step of encoding is to reverse the ASCII string: 7010117928411101701997927.
Constraints
1 <= |s| <= 105 s[i]is an ascii character in the range [A-Z a-z] or a space characterMore Goldman Sachs problems
public String decodingString(String encode) {
// write your code here
}
encode"HackerRank"
expected"729799107101114328297110107"
checking account