Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HandsOn 1 : Periodic String You are given a binary string S , consisting of O ' s and 1 ' s . A string

HandsOn
1: Periodic String
You are given a binary string S, consisting of O's and 1's.
A string B has period K if B[i]=B[i]+K for all i from 1 to |B|-K.
Your task is to find a string T which satisfies the following conditions:
|T|2**|S|
S is a subsequence of T
T has the smallest period possible.
Note:
|B| denotes the length of string B.
Input Format
The first line contains a string, S, denoting the given string.
Constraints
1len(S)105
Sample Test Cases
Case 1
Input:
00000
Output:
00000
Explanation:
Given S=00000
T can be "00000" as it satisfies all of the given conditions.
Case 2
Input:
10101010
Output:
1010101010101010
Explanation:
Given S=10101010
T can be "1010101010101010" as it satisfies all of the given conditions.
Case 3
Input:
11111
Output:
11111
Explanation:
Given S=11111
T can be "11111" as it satisfies all of the given conditions.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

What is quality of work life ?

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago