def assemble(fragments: list[tuple[str, str, str]]) -> str:
The round: mostly a Microsoft AI (MAI) phone screen. Four candidates report it between November 2025 and May 2026: two on MAI teams and two on Copilot teams, where one got it in a senior onsite loop as its second coding round. It is one problem with follow-ups. One poster had 60 minutes, about 45 of them for coding, and had to run tests. Three reports give the same three steps, and this page grades all three: chain the fragments by their tags, then assemble them when a fragment's direction is unknown, then return every chain when there are several. The fourth report, from MAI, stops after the second step.
A fragment is a tuple (tag1, tag2, payload). Tags are short strings such as "AAA"; the payload is any string. The payload text is never reversed, only the order of the fragments.
Part 1 — chain by tags
def assemble(fragments: list[tuple[str, str, str]]) -> str: ...
(start_tag, end_tag, payload). One fragment's end tag equals the next one's start tag. Use every fragment. There is exactly one valid order, and every tag is unique.("AAA","AAC","AAAA"), ("AGG","ACC","GGGG"), ("AAC","ACT","TTTT"), ("ACT","AGG","CCCC") chain as AAA → AAC → ACT → AGG → ACC, so the answer is "AAAATTTTCCCCGGGG".Notes: the function names, the tuple input and the list return in Part 3 are ours. One report uses a Sequence object with startId, endId and payload, and a single function shotgunSequence for both of the first two steps. The reports do not say whether Part 3 keeps the direction rule of Part 1 or of Part 2; two of them call it a follow-up on top of the unknown-direction step, so the tests use Part 2's rule. Whether a chain can close into a loop with no free end was asked in the threads and never answered, so no test has one.
Four reports, all from Microsoft AI teams. One MAI candidate got through the first step quickly, ran out of time finishing the Euler-path step and was rejected a few days later; they asked readers whether it counts as a hard problem. Another MAI candidate needed many hints to debug the second step, only described the third and failed. A Copilot MTS phone-screen candidate and an MAI Copilot senior candidate (the second coding round of the onsite, not selected) posted the same three-step version. Commenters disagreed about the second step: one thought it needed Hierholzer's algorithm, others said it was easy given the guarantees (start from a tag that appears once), and one pointed out that the reported example has a repeated tag. The interviewer in one report said little before the coding started.
Also reported as Shotgun Sequence · Sort DNA Sequence
The round: mostly a Microsoft AI (MAI) phone screen. Four candidates report it between November 2025 and May 2026: two on MAI teams and two on Copilot teams, where one got it in a senior onsite loop as its second coding round. It is one problem with follow-ups. One poster had 60 minutes, about 45 of them for coding, and had to run tests. Three reports give the same three steps, and this page grades all three: chain the fragments by their tags, then assemble them when a fragment's direction is unknown, then return every chain when there are several. The fourth report, from MAI, stops after the second step.
A fragment is a tuple (tag1, tag2, payload). Tags are short strings such as "AAA"; the payload is any string. The payload text is never reversed, only the order of the fragments.
Part 1 — chain by tags
def assemble(fragments: list[tuple[str, str, str]]) -> str: ...
(start_tag, end_tag, payload). One fragment's end tag equals the next one's start tag. Use every fragment. There is exactly one valid order, and every tag is unique.("AAA","AAC","AAAA"), ("AGG","ACC","GGGG"), ("AAC","ACT","TTTT"), ("ACT","AGG","CCCC") chain as AAA → AAC → ACT → AGG → ACC, so the answer is "AAAATTTTCCCCGGGG".Part 2 — unknown direction
def assemble_undirected(fragments: list[tuple[str, str, str]]) -> str: ...
(tag1, tag2, payload) with no start or end. Two fragments can join when they share a tag, in either direction. Use every fragment exactly once. A valid order always exists.(A,B,AAAA), (B,C,TTTT), (C,D,CCCC), (D,B,GGGG) passes through B twice: A → B → C → D → B gives "AAAATTTTCCCCGGGG"."HelloWorld!Done" or "Done!WorldHello"). When several orders are valid, the tests accept any one of them; that rule is ours, since the reports only say either direction is fine.Part 3 — several chains
def assemble_all(fragments: list[tuple[str, str, str]]) -> list[str]: ...
Notes: the function names, the tuple input and the list return in Part 3 are ours. One report uses a Sequence object with startId, endId and payload, and a single function shotgunSequence for both of the first two steps. The reports do not say whether Part 3 keeps the direction rule of Part 1 or of Part 2; two of them call it a follow-up on top of the unknown-direction step, so the tests use Part 2's rule. Whether a chain can close into a loop with no free end was asked in the threads and never answered, so no test has one.
Now each fragment just has two tags and you are not told which is the start and which is the end. Fragments can join in either direction when they share a tag. Implement the same thing.
What if the input holds several chains that are not connected to each other? Detect and return all of them.
| Approach | Notes |
|---|---|
| Part 1 can also find the head by set difference of start and end tags and then follow the map | — |
| it is the same O | n) idea. For Part 3, a BFS from each unvisited tag works as well as union-find. |
Common mistakes: Running out of time on the unknown-direction step: one candidate nearly finished it and was rejected, another needed many hints to debug it and could only describe the last step. Assuming a tag appears at most twice: the reported example passes through B twice. Reversing payload text when a fragment is used backwards.
What candidates did: Commenters split on the second step. One reached for an Euler path with Hierholzer's algorithm; others said the guarantees (a valid order exists, every fragment is used) make it easy if you start from a tag that appears once. That shortcut only works on a plain chain; on the reported example, start from a tag that appears an odd number of times. For the last step a commenter said: build the graph, then search it.
Edge cases to test: The four-fragment example given out of order (answer AAAATTTTCCCCGGGG). The A-B, B-C, C-D, D-B example where a tag repeats. A chain presented backwards. A single fragment. Several chains that share no tag.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 39 Microsoft questions, refreshed monthly from new candidate reports.