Ring Buffer Dump Lookup accepts searches that miss the last entry

未关闭
#838 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@s4512138 已经在做这个了。

开始于 2026年11月24日。

  • #843 来自 @s4512138 —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

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.
主要语言
Rust
星标
236
派生
153
平均合并
1 天 9 小时
30 天内合并 PR
187

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/codetrial 的其他 Issue

查看 sysprog21/codetrial 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。