Largest Binary Number by Concatenation
Reported by candidates from Adobe's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Adobe OA reported in August 2026 looks like a binary string problem, but it's really a custom sort in disguise. You get an array of binary strings, reorder them, and glue them into the biggest possible result. If you're taking this in the next day or two, the whole question comes down to one comparator. StealthCoder is there as a safety net on the live OA if you blank on the comparator, but you can learn this one in ten minutes.
The problem
Given an array binaries of non-empty binary strings, reorder every string exactly once and concatenate them. Return the lexicographically largest concatenation. Because all candidate concatenations have the same total length and contain only 0 and 1, this is also the largest binary value. Preserve every input character, including leading zeros. Function largestBinaryConcatenation(binaries: String[]) → String Examples Example 1 binaries = ["10","101","1"] return = "110110" The order 1, 101, 10 produces 110110. For every adjacent pair, placing the first string before the second gives the larger pairwise concatenation. Example 2 binaries = ["0","00","1"] return = "1000" The string 1 must come first. The two zero-only strings commute, and all of their zeros are preserved, so the result is 1000. Constraints 1 <= binaries.length <= 10^4 1 <= binaries[i].length 1 <= sum of all string lengths <= 10^5 Every character is 0 or 1.
Reported by candidates. Source: FastPrep
Pattern and pitfall
What the problem really reduces to: sort the strings so that for any two, a before b whenever a+b > b+a. Compare the concatenations, not the strings themselves. That's the whole trick. Plain lexicographic sort fails because "10" vs "101" gives the wrong order. Check Example 1: sorted by the comparator you get 1, 101, 10, which yields 110110. The comparator is a valid total preorder since all strings share the same alphabet, so the greedy exchange argument holds. Pitfalls: don't strip leading zeros, and don't convert to integers, since the total length reaches 10^5. Sorting costs O(n log n) comparisons, each O(L), which is fine here. In Python use cmp_to_key. In Java use a comparator on (b+a).compareTo(a+b). If you freeze live, StealthCoder can surface the comparator while you keep typing, but you should be able to write it from memory.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Largest Binary Number by Concatenation cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as largest number. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Adobe's OA.
Adobe reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Largest Binary Number by Concatenation FAQ
What's the trick in the Adobe largest binary concatenation question?+
Sort with a custom comparator: put a before b if a+b is greater than b+a. Then join the sorted list. That's the entire solution. The binary alphabet doesn't change anything, it works the same as the classic largest-number concatenation problem.
Why doesn't normal string sorting work?+
Plain lexicographic order ignores how strings combine. "10" and "101" show it: sorted descending normally you'd place 101 before 10, which happens to work here, but other pairs break. The comparator on concatenations is the only rule that's correct for every pair, so always use it.
Do I need to worry about leading zeros or all-zero input?+
Keep every character. The problem says to preserve leading zeros, so don't strip anything or parse to an integer. With input like ["0","00"] the answer is "000", not "0". Just join the sorted strings as they are.
What's the time complexity and will it pass at 10^5 characters?+
Sorting is O(n log n) comparisons and each comparison builds strings up to the combined length of the two. With total length 10^5 and up to 10^4 strings, it's fine in practice. Avoid repeated string concatenation in a loop when building the final answer, use a join.
How do I prepare for this in 48 hours?+
Write the comparator sort three times from scratch in your OA language. Test it on the two examples, then on ["0","0"] and a mixed case like ["1","10","11"]. Learn how your language does custom comparators, since that's where people lose time, not in the idea.