Amazon Robotics is optimizing the dataset shipment process.
You are given a binary string shipmentData consisting only of '0' and '1'.
Process Definition:
Start with an empty finalSequence.
For each character c in shipmentData from left to right:
- Append
ctofinalSequence - Reverse the entire
finalSequence
This continues until all bits are processed.
Goal:
Determine the best ordering of bits in shipmentData that produces the lexicographically largest possible finalSequence.
Return that optimal ordering of shipmentData.
Example: Input: 0100 Output: 0001
Function Signature: string getDatasetOrder(string shipmentData);
Constraints: 1 ≤ shipmentData.length() ≤ 10^5 Characters are only '0' and '1'