Novo curso: Como conseguir vagas remotas em empresas que pagam $120k+/ano
NaGringa
CodingJunior

Leetcode 444. Sequence Reconstruction

Given an original sequence and a list of subsequences, determine whether those subsequences uniquely determine the original order — equivalently, whether the precedence constraints induce a unique topological ordering equal to the given sequence. Model subsequences as directed edges and check that a topological sort exists and is unique (only one candidate with indegree zero at each step) matching the original.

Empresas em que apareceu
GoogleGoogle
Contextos reais

Onde essa pergunta já apareceu

Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.

Googlejuniorout. de 2024

Given a list of pairs where each pair indicates that the first character is greater than the second, find a proper increasing sequence of all the characters if possible, otherwise return 'None'. For example, the list might look like: [['a', 'b'], ['b', 'd'], ['d', 'c'], ['a', 'd'], ['a', 'c']] (where 'a > b', 'b > d', and so on). This problem can be solved using topological sorting.

Anexos públicos

Materiais associados

Nenhum anexo público associado a esta pergunta.

Próximo passo

Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.

Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.

Continue a preparação com o banco completo

No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.