Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Tomriny is playing a string-puzzle where he needs to design apath that requires max effort to cross it. He is provided with'n' binary surings A1.
Tomriny is playing a string-puzzle where he needs to design apath that requires max effort to cross it. He is provided with'n' binary surings A1. A2 An of equal length m ' where elements in binary string representing I signify valley and v signify plain. He needs to concatenate all n binary string such that the resullant binary string provides max effort i.. maximum effort among all concatenated strings) Effurt for a given string a is the number of (valley. plain) pairs ie ai =1&aj=0;&(cj) Help Tommy to find max effori Example 1: input 24.>integer n denoting number of binary string and m denoting length of string 10113 Denoting Binary string A1 ait s Denoting Binary String A2 Output: 33.s integer n denoting number of binary strings and m denoting lengh of string. 101 - Denoting Binary String A1 110-> Denoting Binary String A2. 010: Denoting Binary String A3. Explanation: A2+A1+A3=110101010 gives effort =14 ir can be veriiled that none other results produce strings with Higher effort Constraints: 1.2s=nc=103 2.1s=mc=103 The input format for testing: The candidate has to write the code to accept 2 inputs. - First input it will contain space separated integers n inumber of binary strings) and m flength of binary strings). - Second input. For next n lines, ith line contains Aith binary string. The Output format for testing: -The output will contain a single unteger denoting max effort - Additional messages in output will cause the failure of Lest cases
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started