PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

Interleave three equal-length strings by taking the character at each index from the first, second, and third string in order. Preserve arbitrary Unicode characters, handle empty inputs, and build the result efficiently without quadratic repeated concatenation.

  • easy
  • Upstart
  • Coding & Algorithms
  • Software Engineer

Interleave Three Equal-Length Strings

Company: Upstart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Take-home Project

# Interleave Three Equal-Length Strings Given three strings of equal length, build a result by taking the character at index `0` from each string, then the character at index `1` from each string, and so on. ### Function Signature ```python def interleave_three(first: str, second: str, third: str) -> str: ... ``` ### Example ```text Input: first = "abc", second = "def", third = "ghi" Output: "adgbehcfi" ``` ### Constraints - `0 <= len(first) == len(second) == len(third) <= 200_000` - Inputs may contain arbitrary Unicode characters. ### Clarifications - Preserve each input's character order. - For three empty strings, return the empty string. - Do not add separators. - Inputs are guaranteed to have equal lengths. ### Hints - Traverse corresponding positions together. - Avoid repeated immutable-string concatenation if it makes the runtime quadratic in your language.

Quick Answer: Interleave three equal-length strings by taking the character at each index from the first, second, and third string in order. Preserve arbitrary Unicode characters, handle empty inputs, and build the result efficiently without quadratic repeated concatenation.

Given three equal-length strings, build a new string by appending the character at each index from the first, second, and third strings in that order. Preserve all Unicode characters and add no separators.

Constraints

  • All three inputs are strings of equal length.
  • The inputs may be empty.
  • Characters may be arbitrary Unicode.
  • Preserve each input's character order.
  • Avoid repeated quadratic string concatenation.

Examples

Input: ("", "", "")

Expected Output: ''

Explanation: Three empty strings interleave to empty.

Input: ("abc", "def", "ghi")

Expected Output: 'adgbehcfi'

Explanation: The prompt example takes one character from each string per index.

Hints

  1. Traverse corresponding positions together.
  2. Append three characters per index to a list.
  3. Join the list once after the traversal.
Last updated: Jul 15, 2026

Loading coding console...

PracHub

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

Product

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

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding 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.

Related Coding Questions

  • Remove Duplicate Integers While Preserving Order - Upstart (easy)
  • Rewrite Sentence-Ending Punctuation - Upstart (easy)
  • Scale Ingredient Quantities - Upstart (easy)
  • Compute a Point Set's Bounding Rectangle - Upstart (easy)
  • Report Where a Value Appears - Upstart (easy)