Oracle OCI | Onsite | Parse Escaped Characters

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-03-17Added By Anonymous
Source: Link

Company: Oracle
Role: unknown
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

Given a string, convert

& to &
" to "
' to '
> to >
&lt; to <

Example 1:
Input: "This is &amp;"
Output: "This is &"

Example 2:
Input: "This is &amp;&gt;"
Output: "This is &>"

Example 3:
Input: "This is &&amp;"
Output: "This is &&"

Comments