Company: capital one IITK
Difficulty: medium
Maximum profit Problem Description Given two binary strings S and Q of length N consisting of characters '0' or '1'. Consider a non-empty substring S1 of S and a non-empty substring Q1 of Q of the same lengths. Let X be the string obtained after taking the exclusive-or of S1 and Q1. You are given a Profit function: Profit = floor(len(X)/2 X 10 ) where X 10 is the decimal value of binary representation of X and len(X) is the length of string X. Notes A substring is a contiguous sequence of characters within a string. For example the list of all non-empty substrings of the string "apple" would be "apple", "appl", "pple", "app", "ppl", "ple", "ap", "pp", "pl", "le", "a", "p", "l", "e". Exclusive-or compares two input bits and generates one output bit. If the bits are the same, the result is 0. If the bits are different, the result is 1. In the string X, the leftmost character is treated as the MSB (Most Significant Bit) and the rightmost character is treated as LSB (Least Significant Bit)