Quick Overview

Infer a valid alien alphabet from words already sorted in that language. Build precedence constraints from adjacent words, reject invalid prefix orderings and cycles, and produce the lexicographically smallest topological order when several answers are possible.

Infer an Alien Alphabet from Sorted Words

Company: ByteDance

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Infer a valid alien alphabet from words already sorted in that language. Build precedence constraints from adjacent words, reject invalid prefix orderings and cycles, and produce the lexicographically smallest topological order when several answers are possible.

Read the full ByteDance Software Engineer interview experience this question came from

Loading…