Tag: binary-search
9 รายการ
Blog

LeetCode #57 Insert Interval: หมี มด เหยี่ยว แข่งแทรกช่วงเวลา
แทรกช่วงเวลาแล้วรวมส่วนที่ทับกันด้วย Python 3 วิธี ผ่านวงโต้วาทีของหมี มด และเหยี่ยว พร้อมเทสต์และ benchmark ที่รันจริง

LeetCode #35 Search Insert Position: เต่า เหยี่ยว แมว ชิงตำแหน่งเสียบเลข
เทียบ 3 วิธีหาตำแหน่งแทรกในลิสต์เรียงแล้ว ตั้งแต่เดินทีละช่องถึง binary search และ bisect พร้อมเทสต์และ benchmark ที่รันจริง
LeetCode 4 Median of Two Sorted Arrays: แบ่งสองฝั่งให้ซ้ายไม่เกินขวา
เทียบ merge, kth elimination และ binary partition พร้อม complexity, edge cases, decision table และ Python tests ที่รันจริง
LeetCode 287 Find the Duplicate Number: 4 วิธีจาก Set ถึง Floyd Cycle
เทียบ hash set, sort, binary search บนช่วงค่า และ Floyd cycle detection พร้อม decision table และ Python tests
LeetCode #153 หาเลขน้อยสุดใน rotated array: อ่านรอยต่อด้วย binary search
เทียบ linear scan, sort-copy และ binary search พร้อม decision table, edge cases และ Python tests
Rust partition_point: หาเส้นแบ่งใน slice ที่เรียงตามเงื่อนไข
ใช้ binary search หา index แรกที่ predicate เปลี่ยนจากจริงเป็นเท็จ พร้อม edge cases และ test ที่รันจริง
LeetCode #300 LIS: จาก DP ตารางตรงไปตรงมาถึง patience sorting และ Fenwick tree
เทียบสามวิธีหา longest increasing subsequence พร้อม strict-increasing detail, complexity และ unittest
LeetCode 33: ค้นหาใน Array ที่หมุนแล้ว เลือก Linear หรือ Binary ดี
เทียบ 3 วิธีตั้งแต่สแกนตรง, หา pivot แล้ว binary search และ one-pass binary พร้อมตารางตัดสินใจและ test ครบ edge case
LeetCode #704 Binary Search: บีบช่วงค้นหาโดยไม่หลุดขอบ
เทียบ linear, iterative, recursive และ bisect พร้อม invariant, edge cases และ Python unittest