1p3a Question · Jan 2026

Amazon Online Assessment OA Coding Question Binary String Reversal

Question Details

Hi everyone, i had an amazon OA today, received two questions for coding test. You are given a binary string S consisting only of '0' and '1'. You build a new string finalS using the following operati

Full Details

Hi everyone, i had an amazon OA today, received two questions for coding test. You are given a binary string S consisting only of '0' and '1'. You build a new string finalS using the following operation: Start with an empty string finalS= "" For each character c in shipmentData (from left to right): push c in finalS, reverse finalS. Your task is to rearrange the characters of shipmentData (you may reorder it arbitrarily) such that the resulting finalSequence is lexicographically maximum.

Return the rearranged shipmentData that produces this maximum finalSequence. Can anyone come up with the solution as i was not able to pass all the test cases. Would be great if someone gives me tips to prepare for OA rounds man, i have solved a lot of leetcode questions but never came across such question before

About This Question

This is a reported interview question from a amazon interview for a swe role during the oa round reported in 2026.

It covers the following topics: Strings .

Topics