Company: Amazon_14nov

Difficulty: medium

Problem Statement

Problem Description Amazon's fulfillment system processes a binary string called shipmentData to produce another binary string known as finalSequence via a transformation process. The transformation process works as follows: 1. Start with an empty finalSequence, i.e., finalSequence = "". 2. For each index i (0 <= i < len(shipmentData)): - Append shipmentData[i] to finalSequence. - Reverse the entire finalSequence. Before this transformation is applied, the string shipmentData can be reordered. The task is to find the configuration of shipmentData that produces the lexicographically maximum finalSequence. Note: A string a is considered lexicographically larger than a string b if either of the following conditions is satisfied: - b is a prefix of a, but a != b - In the first position where a and b differ, a contains a 1, and b contains a 0. Example 1 Example 1 Input: shipmentData = "1101" Output: "1101" Explanation Exploring all possible configurations: For shipmentData = "0111" -&

More Amazon_14nov OA questionsInterview experiences