Metric Namespace Root judge accepts solutions that ignore middle strings

Aberta
#863 2 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@explosion3975 já está trabalhando nisso.

Desde 26/11/2026.

  • #866 de @explosion3975 — aberto

Avaliação

Esta issue ainda não foi avaliada.

Descrição

Observed behavior

The five built-in cases for Metric Namespace Root (longest-common-prefix, LeetCode 14) all accept a solution that compares only the first and last strings in the input array. It never examines the strings between them.

def sharedLeadingText(strs):
    first, last = strs[0], strs[-1]
    i = 0
    while i < min(len(first), len(last)) and first[i] == last[i]:
        i += 1
    return first[:i]
Expected behavior

The judge should reject a solution that ignores a middle string. The contract requires the returned prefix to be shared by every string.

Proposed fix

Add ["flower", "dog", "flow"] with expected output "" as a built-in case. Append it after the existing cases so the variant's example reference keeps pointing to the same case.

Could you assign this issue to me?

Linguagem predominante
Rust
Estrelas
236
Forks
153
Merge médio
1d 9h
PRs com merge (30d)
187

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de sysprog21/codetrial

Todas as issues de sysprog21/codetrial

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.