Ring Buffer Dump Lookup accepts searches that miss the last entry

Abierto
#838 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@s4512138 ya está trabajando en esto.

Desde el 24/11/2026.

  • #843 de @s4512138 — abierto

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Observed behavior

The five built-in cases for Ring Buffer Dump Lookup (search-in-rotated-sorted-array) all pass for two incorrect implementations of the sorted-half binary search: one uses an exclusive right bound, and one treats a one-element left half as unsorted.

Expected behavior

A candidate must return the zero-based position of every present target, including the last element of a wrapped dump.

Reproduction
  1. Run a sorted-half binary search against the five built-in cases.
  2. Change only target <= nums[hi] in the sorted-right-half branch to target < nums[hi]. The built-in cases still pass 5/5, but locateSequenceNumber([3, 1, 2], 2) returns -1 instead of 2.
  3. Restore the right bound and change only the sorted-left-half test from nums[lo] <= nums[mid] to nums[lo] < nums[mid]. The built-in cases still pass 5/5, but locateSequenceNumber([2, 1], 1) returns -1 instead of 1.
CodeTrial version

Source at c24068bb67a06536cd6472ce91c1563fb38f472b

Environment

Windows, Node.js v24.22.0. I exercised CodeTrial's JavaScript runner and answer checker with a Node adapter for the Worker API. With both cases appended in memory, the correct search passes 7/7 and both incorrect versions pass 6/7.

Sanitized evidence
Proposed scope

Add these two cases to the judge source, regenerate the browser judge, update the task digest and contract assertions, and add a regression that checks which labeled case rejects each wrong implementation. Could you confirm the scope and assign this issue to me?

The examples are synthetic and contain no credentials or personal interview data.

Public data confirmation
  • I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
Lenguaje dominante
Rust
Estrellas
236
Forks
153
Merge medio
1 d 9 h
PR fusionados (30 d)
187

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sysprog21/codetrial

Todos los issues de sysprog21/codetrial

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.