PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Microsoft

Assemble DNA payload strings from tagged fragments

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in string manipulation, sequence assembly, and labeled-graph path reconstruction—skills involved in ordering fragments by matching start/end tags and concatenating payloads—and it belongs to the Coding & Algorithms domain.

  • medium
  • Microsoft
  • Coding & Algorithms
  • Software Engineer

Assemble DNA payload strings from tagged fragments

Company: Microsoft

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of DNA-like fragments. Each fragment is a tuple: - `start_tag`: string - `end_tag`: string - `payload`: string A valid DNA chain is formed by ordering fragments so that the `end_tag` of one fragment matches the `start_tag` of the next fragment. The assembled DNA string is the concatenation of `payload`s in chain order. Assume tags are arbitrary strings (e.g., `"AAA"`, `"AAC"`). ## Q1: Single forward chain Given fragments that form exactly one continuous chain using the rule `prev.end_tag == next.start_tag`, assemble and output the final concatenated string. Example: Input: - `(XXX, ATG, "Hello")` - `(ATG, GCA, "World")` - `(GCA, TAG, "!")` - `(TAG, YYY, "Done")` Output: - `"HelloWorld!Done"` ## Q2: Chain can be traversed in either direction Now treat each fragment as connecting two tags, and you may traverse the final chain either in the forward direction or in the reverse direction. - Forward traversal outputs payloads in forward order. - Reverse traversal outputs payloads in reverse order. - Either output is acceptable. For the example above, valid outputs include: - `"HelloWorld!Done"` (forward) - `"Done!WorldHello"` (reverse) ## Q3: Multiple DNA chains Now the input fragments may form multiple disjoint chains (still assuming they can be arranged into simple chains with no branching within a chain). Output all assembled strings, one per chain, in any order. ### Output format - Q1/Q2: a single string - Q3: a list/array of strings (one per chain)

Quick Answer: This question evaluates proficiency in string manipulation, sequence assembly, and labeled-graph path reconstruction—skills involved in ordering fragments by matching start/end tags and concatenating payloads—and it belongs to the Coding & Algorithms domain.

Related Interview Questions

  • Sort Three Categories In Place - Microsoft (medium)
  • Implement K-Means and Detect Divisible Subarrays - Microsoft (medium)
  • Implement SFT Sample Packing - Microsoft (medium)
  • Implement SQL Table and DNA Ordering - Microsoft (medium)
  • Solve power jumps and graph tour - Microsoft (hard)
Microsoft logo
Microsoft
Dec 15, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
10
0

You are given a list of DNA-like fragments. Each fragment is a tuple:

  • start_tag : string
  • end_tag : string
  • payload : string

A valid DNA chain is formed by ordering fragments so that the end_tag of one fragment matches the start_tag of the next fragment. The assembled DNA string is the concatenation of payloads in chain order.

Assume tags are arbitrary strings (e.g., "AAA", "AAC").

Q1: Single forward chain

Given fragments that form exactly one continuous chain using the rule prev.end_tag == next.start_tag, assemble and output the final concatenated string.

Example:

Input:

  • (XXX, ATG, "Hello")
  • (ATG, GCA, "World")
  • (GCA, TAG, "!")
  • (TAG, YYY, "Done")

Output:

  • "HelloWorld!Done"

Q2: Chain can be traversed in either direction

Now treat each fragment as connecting two tags, and you may traverse the final chain either in the forward direction or in the reverse direction.

  • Forward traversal outputs payloads in forward order.
  • Reverse traversal outputs payloads in reverse order.
  • Either output is acceptable.

For the example above, valid outputs include:

  • "HelloWorld!Done" (forward)
  • "Done!WorldHello" (reverse)

Q3: Multiple DNA chains

Now the input fragments may form multiple disjoint chains (still assuming they can be arranged into simple chains with no branching within a chain). Output all assembled strings, one per chain, in any order.

Output format

  • Q1/Q2: a single string
  • Q3: a list/array of strings (one per chain)

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Microsoft•More Software Engineer•Microsoft Software Engineer•Microsoft Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.