VMware | Decode all possibilities from a given encoded ASCII string

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2018-01-23Added By Anonymous
Source: Link

We encode a string, s, by performing the following sequence of actions:

•Replace each character with its ASCII value representation.
•Reverse the string.


For example, the table below shows the conversion from the string "Go VMWare" to the ASCII string "711113286778797114101":


Character G o V M W a r e

ASCII Value 71 111 32 86 77 87 97 114 101


We then reverse the ASCII string to get the encoded string 101411797877682311117.


For reference, the characters in s are ASCII characters within the range 10 - 126 which include special characters.


The function must decode the encoded string and return the list of ways in which s can be decoded.

1// encoded - A reversed ASCII string denoting an encoded string s 2static Collection<String> decode(String encoded) { 3 4 return Collection<String> 5}
Comments