Skip to content

Commit

Permalink
Update 0035.搜索插入位置.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Junqiao committed Sep 24, 2023
1 parent 97587fb commit e14fb76
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions problems/0035.搜索插入位置.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,37 @@ public int searchInsert(int[] nums, int target) {



### C#

```go
public int SearchInsert(int[] nums, int target) {

var left = 0;
var right = nums.Length - 1;

while (left <= right) {

var curr = (left + right) / 2;

if (nums[curr] == target)
{
return curr;
}

if (target > nums[curr]) {
left = curr + 1;
}
else {
right = curr - 1;
}
}

return left;
}
```



### Golang

```go
Expand Down Expand Up @@ -500,3 +531,4 @@ int searchInsert(int* nums, int numsSize, int target){
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

0 comments on commit e14fb76

Please sign in to comment.