Ring Buffer Dump Lookup accepts searches that miss the last entry

Open
#838 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@s4512138 is already working on this.

Since Nov 24, 2026.

  • #843 by @s4512138 — open

Assessment

This issue has not been assessed yet.

Description

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.
Dominant language
Rust
Stars
236
Forks
153
Avg merge
1d 9h
Merged PRs (30d)
187

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sysprog21/codetrial

All issues in sysprog21/codetrial

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.