Ring Buffer Dump Lookup accepts searches that miss the last entry

Đang mở
#838 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@s4512138 đang làm issue này rồi.

Từ ngày 24/11/2026.

  • #843 của @s4512138 — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.
Ngôn ngữ chính
Rust
Star
236
Fork
153
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
187

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sysprog21/codetrial

Tất cả issue của sysprog21/codetrial

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.