mirror of
https://github.com/labuladong/fucking-algorithm.git
synced 2025-07-04 11:22:59 +08:00
修改一些小问题
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
# Remove Duplicates from Sorted Array
|
||||
|
||||
Translator:[Hi_archer][1]
|
||||
Author:[labuladong][2]
|
||||
Translator: [Hi_archer][1]
|
||||
|
||||
Author: [labuladong][2]
|
||||
|
||||
We know that for arrays,it is efficient to insert and delete elements at the end,with a time complexity of O(1).However, if we insert and delete elements at the middle or the beginning,it will move many data, with a time complexity of O(N).
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@ -157,7 +157,7 @@ int left_bound(int[] nums,int target){
|
||||
|
||||
>A2: Before this, let's think about what's meaning of `left border` is:
|
||||
|
||||

|
||||

|
||||
|
||||
For this array, the algorithm will get result `1`. The result `1` can be interpreted this way: there is 1 element in `nums` which element is less than 2.
|
||||
|
||||
@ -243,7 +243,7 @@ int right_bound(int[] nums,int target){
|
||||
//Thinking this way: mid = left - 1
|
||||
}
|
||||
```
|
||||

|
||||

|
||||
|
||||
When we update the value of `left`, we must do it this way: `left = mid + 1`, which means when `while` is terminated, `nums[left]` must not equal to `target`, but `nums[left-1]` could be equal to `target`.
|
||||
|
BIN
算法思维系列/.DS_Store
vendored
BIN
算法思维系列/.DS_Store
vendored
Binary file not shown.
Reference in New Issue
Block a user