Amazon | Phone Screen | Amazonian Strings
Anonymous User
733
Jul 07, 2024
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
Comments (9)


