2025-05-17提交

This commit is contained in:
asahi
2025-05-17 17:01:56 +08:00
parent c4e1e74677
commit a62543b3fd
7 changed files with 454 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
/*
* @lc app=leetcode id=35 lang=java
*
* [35] Search Insert Position
*/
// @lc code=start
class Solution {
public int searchInsert(int[] nums, int target) {
int l=0, r = nums.length;
int m;
while(l<r) {
m = l + (r-l)/2;
if(nums[m] >= target) {
r = m;
} else {
l = m + 1;
}
}
return l;
}
}
// @lc code=end