Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from youngyangyang04:master #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 11 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jul 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
3a76b3a
更新 0704.二分查找 排版格式
jinbudaily Jul 17, 2023
948aca8
更新 0704.二分查找 排版格式修复
jinbudaily Jul 17, 2023
60e2391
Merge pull request #2183 from jinbudaily/master
youngyangyang04 Jul 17, 2023
fdbc744
更新 027.移除元素 排版格式修复
jinbudaily Jul 17, 2023
ec101be
更新 0977.有序数组的平方
jinbudaily Jul 17, 2023
76c84ef
更新 0209. 长度最小的子数组 排版格式修复
jinbudaily Jul 17, 2023
7a30d50
更新 059.螺旋矩阵II 排版格式修复
jinbudaily Jul 17, 2023
053632c
更新 数组总结篇 排版格式修复
jinbudaily Jul 17, 2023
a3cc34e
更新 数组理论基础 排版格式修复
jinbudaily Jul 17, 2023
23c558f
Merge branch 'master' of github.com:jinbudaily/leetcode-master
jinbudaily Jul 17, 2023
ae4300d
Merge pull request #2184 from jinbudaily/master
youngyangyang04 Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
更新 027.移除元素 排版格式修复
  • Loading branch information
jinbudaily committed Jul 17, 2023
commit fdbc7442ac2b685414544f0af79d64c40da05d0f
35 changes: 21 additions & 14 deletions problems/0027.移除元素.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center"><strong><a href="https://mp.weixin.qq.com/s/tqCxrMEU-ajQumL1i8im9A">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>


## 27. 移除元素
# 27. 移除元素

[力扣题目链接](https://leetcode.cn/problems/remove-element/)

Expand Down Expand Up @@ -159,8 +159,8 @@ public:

## 其他语言版本

### Java:

Java:
```java
class Solution {
public int removeElement(int[] nums, int val) {
Expand Down Expand Up @@ -197,7 +197,7 @@ class Solution {
}
```

Python:
### Python:


``` python 3
Expand Down Expand Up @@ -233,8 +233,8 @@ class Solution:

```

### Go:

Go:
```go
func removeElement(nums []int, val int) int {
length:=len(nums)
Expand Down Expand Up @@ -275,7 +275,8 @@ func removeElement(nums []int, val int) int {
}
```

JavaScript:
### JavaScript:

```javascript
//时间复杂度:O(n)
//空间复杂度:O(1)
Expand All @@ -290,7 +291,7 @@ var removeElement = (nums, val) => {
};
```

TypeScript:
### TypeScript:

```typescript
function removeElement(nums: number[], val: number): number {
Expand All @@ -305,7 +306,7 @@ function removeElement(nums: number[], val: number): number {
};
```

Ruby:
### Ruby:

```ruby
def remove_element(nums, val)
Expand All @@ -319,7 +320,8 @@ def remove_element(nums, val)
i
end
```
Rust:
### Rust:

```rust
impl Solution {
pub fn remove_element(nums: &mut Vec<i32>, val: i32) -> i32 {
Expand All @@ -335,7 +337,7 @@ impl Solution {
}
```

Swift:
### Swift:

```swift
func removeElement(_ nums: inout [Int], _ val: Int) -> Int {
Expand All @@ -351,7 +353,8 @@ func removeElement(_ nums: inout [Int], _ val: Int) -> Int {
}
```

PHP:
### PHP:

```php
class Solution {
/**
Expand All @@ -375,7 +378,8 @@ class Solution {
}
```

C:
### C:

```c
int removeElement(int* nums, int numsSize, int val){
int slow = 0;
Expand All @@ -391,7 +395,8 @@ int removeElement(int* nums, int numsSize, int val){
}
```

Kotlin:
### Kotlin:

```kotlin
fun removeElement(nums: IntArray, `val`: Int): Int {
var slowIndex = 0 // 初始化慢指针
Expand All @@ -402,7 +407,8 @@ fun removeElement(nums: IntArray, `val`: Int): Int {
}
```

Scala:
### Scala:

```scala
object Solution {
def removeElement(nums: Array[Int], `val`: Int): Int = {
Expand All @@ -418,7 +424,8 @@ object Solution {
}
```

C#:
### C#:

```csharp
public class Solution {
public int RemoveElement(int[] nums, int val) {
Expand Down

AltStyle によって変換されたページ (->オリジナル) /