---
# System prepended metadata

title: 搜索練習題

---

# 搜索練習題

| 題號 | 題目 | 難度 | 備註 | 題解 |
| -------- | -------- | -------- | -------- | -------- |
|35|[Search insert position](https://leetcode.cn/problems/search-insert-position/)| <font color=DarkGreen>Easy</font>| | |
|278|[First bad version](https://leetcode.cn/problems/first-bad-version/)|<font color=DarkGreen>Easy</font>||
|374|[Guess number higher or lower](https://leetcode.cn/problems/guess-number-higher-or-lower/)|<font color=DarkGreen>Easy</font>||
|704|[Binary search](https://leetcode.cn/problems/binary-search/)|<font color=DarkGreen>Easy</font>||[Binary Search 題解](https://hackmd.io/@paxton0222/B1hw2pgj3)|
|35|[Search Insert Position](https://leetcode.com/problems/search-insert-position/description/?envType=study-plan-v2&envId=top-interview-150)|<font color=DarkGreen>Easy</font>||[Search Insert Position 題解](https://hackmd.io/@paxton0222/HyWQgRgs3)|
|2089|[Find Target Indices After Sorted Array](https://leetcode.com/problems/find-target-indices-after-sorting-array/description/)|<font color=DarkGreen>Easy</font>|二分搜鎖定左右邊界|[Find Target Indices After Sorted Array 題解](https://hackmd.io/@paxton0222/HJFY-0loh)|
|2529|[Maximum Count of Positive Integer and Negative Integer](https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/description/)|<font color=DarkGreen>Easy</font>|二分搜索鎖定邊界|[Maximum Count of Positive Integer and Negative Integer 題解](https://hackmd.io/@paxton0222/Hy9HQRxs2)|
|349|[Intersection of Two Arrays](https://leetcode.com/problems/intersection-of-two-arrays/description/)|<font color=DarkGreen>Easy</font>||[Intersection of Two Arrays 題解](https://hackmd.io/@paxton0222/HkNIN0li2)|
|350|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/description/)|<font color=DarkGreen>Easy</font>||[Intersection of Two Arrays II 題解](https://hackmd.io/@paxton0222/HJ80sQLjh)|
|1337|[The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/description/)|<font color=DarkGreen>Easy</font>|二分搜鎖定邊界|[The K Weakest Rows in a Matrix 題解](https://hackmd.io/@paxton0222/r1e1A0ljh)|
|1385|[Count Negative Numbers in a Sorted Matrix](https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/description/)|<font color=DarkGreen>Easy</font>|二分搜鎖定邊界|[Count Negative Numbers in a Sorted Matrix 題解](https://hackmd.io/@paxton0222/rkkHl2wi2)|
|539|[Kth Missing Positive Number](https://leetcode.com/problems/kth-missing-positive-number/description/)|<font color=DarkGreen>Easy</font>|還沒完全搞懂此題二分原理|[Kth Missing Positive Number 題解](https://hackmd.io/@paxton0222/r1t__SDj3)|
|744|[Find Smallest Letter Greater Than Target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/)|<font color=DarkGreen>Easy</font>||[Find Smallest Letter Greater Than Target 題解](https://hackmd.io/@paxton0222/rk-U3vrC3)|
|852|[Peak index in a mountain array](https://leetcode.cn/problems/peak-index-in-a-mountain-array/)|<font color=Orange>Medium</font>|二分查找找出山峰極值 | [852 二分查找變化題題解](https://hackmd.io/@paxton0222/HJlB9mvai) |
|33|[Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)|<font color=Orange>Medium</font>|二分查找反轉陣列(重要)|[Search in Rotated Sorted Array 題解](https://hackmd.io/@paxton0222/S1IVs8_16)|
|162|[Find peak element](https://leetcode.cn/problems/find-peak-element/?show=1)|<font color=Orange>Medium</font>||
|34|[Find first and last position in sorted array](https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array/)|<font color=Orange>Medium</font>|二分搜索經典題||
|167|[Two Sum II - Input Array Sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/)|<font color=Orange>Medium</font>||[Two Sum II - Input Array Sorted 題解](https://hackmd.io/@paxton0222/r1c061Ujh)|
|15|[3Sum](https://leetcode.com/problems/3sum/)|<font color=Orange>Medium</font>|雙指針 + 排序|[3sum 題解](https://hackmd.io/@paxton0222/rJdtEy7Th)|
|287|[Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/description/)|<font color=Orange>Medium</font>||[Find the Duplicate Number 題解](https://hackmd.io/@paxton0222/rJCd5eIjn)|
|300|[Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/description/)|<font color=Orange>Medium</font>|Greedy + Binary Search、DP|[Longest Increasing Subsequence 題解](https://hackmd.io/@paxton0222/HJxvdGLo2)|
|2389|[Longest Subsequence With Limited Sum](https://leetcode.com/problems/longest-increasing-subsequence/description/)|<font color=Orange>Medium</font>|前綴和 + 二分搜索|[Longest Subsequence With Limited Sum 題解](https://hackmd.io/@paxton0222/HJxvdGLo2)|
|74|[Search a 2d matrix 搜索二維矩陣](https://leetcode.cn/problems/search-a-2d-matrix/)|<font color=Orange>Medium</font>||[Search A 2D Martix 題解](https://hackmd.io/@paxton0222/S1xtpagjn)|
|240|[Search a 2d matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/)|<font color=Orange>Medium</font>||[Search A 2D Martix II 題解](https://hackmd.io/@paxton0222/ByaNuxUs3)|
|1011|[Capacity To Ship Packages Within D Days](https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/description/)|<font color=Orange>Medium</font>||[Capacity To Ship Packages Within D Days 題解](https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/description/)
|1351|[Count negative numbers in a sorted matrix](https://leetcode.cn/problems/count-negative-numbers-in-a-sorted-matrix/)|<font color=Orange>Medium</font>||
|162|[Find Peak Element](https://leetcode.com/problems/find-peak-element/submissions/?envType=study-plan-v2&envId=top-interview-150)|<font color=Orange>Medium</font>|左邊界鎖定|[Find Peak Element 題解](https://hackmd.io/@paxton0222/Hkq1VnA6h)|
|34|[Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/?envType=study-plan-v2&envId=top-interview-150)|<font color=Orange>Medium</font>|左右邊界鎖定|[Find First and Last Position of Element in Sorted Array 題解](https://hackmd.io/@paxton0222/HJPX3Vtka)|
|229|[Majority Element II](https://leetcode.com/problems/majority-element-ii/)|<font color=Orange>Medium</font>|哈希統計線性搜索、二分搜索左右邊界鎖定、摩爾投票法|[Majority Element II 題解](https://hackmd.io/@paxton0222/S18UsTsep)|
|1095|[Find in Mountain Array](https://leetcode.com/problems/find-in-mountain-array/)|<font color=Red>Hard</font>|二分查找山峰、常規二分|[Find in Mountain Array 題解](https://hackmd.io/@paxton0222/rkLYYLBb6)
|668|[Kth Smallest Number in Multiplication Table](https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/description/)|<font color=Red>Hard</font>|還沒有做完 (超時)|[Kth Smallest Number in Multiplication Table](https://hackmd.io/@paxton0222/SJipB48o3)|

## Kth 問題

| 題號 | 題目 | 難度 | 備註| 題解 |
| -------- | -------- | -------- | -------- | -------- |
|215|[Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/)|<font color=Orange>Medium</font>|Priority Queue|[Kth Largest Element in an Array 題解](https://hackmd.io/@paxton0222/S1YtZ6Ejh)|
|378|[Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/)|<font color=Orange>Medium</font>|Priority Queue、Binary Search|[Kth Smallest Element in a Sorted Matrix 題解](https://hackmd.io/@paxton0222/SJaAzTEih)|