Amazon | Phone Screen | Amazonian Strings
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-07-07Added By Anonymous
Source: Link
Company: Amazon
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Given a binary string S, consisting of 0s and 1s. A string B has period K if B[i]=B[i]+K for all i from 1 to size(T) - K. Find a string T which satisfies the following conditions:
* size(T) <= 2 x size(S)
* S is a subsequence of T
* T has the smallest period possible
Input: 10101010
Output: 1010101010101010
Input: 00000
Output: 00000