Ring Buffer Dump Lookup accepts searches that miss the last entry

Offen
#838 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@s4512138 arbeitet bereits daran.

Seit 24.11.2026.

  • #843 von @s4512138 — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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.
Vorherrschende Sprache
Rust
Sterne
236
Forks
153
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
187

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus sysprog21/codetrial

Alle Issues in sysprog21/codetrial

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.