Skip to content

Commit 9f25119

Browse files
committed
add 1 files
0 parents  commit 9f25119

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

2.1.11.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* 给一列数和一个指定的值,除去给定的数值然后返回新的长度
2+
* 算法复杂度O(n)
3+
*/
4+
#include<vector>
5+
#include<iostream>
6+
#include<map>
7+
using namespace std;
8+
class Solution{
9+
public:
10+
int remove(vector<int>& input,int n){
11+
int index=0;
12+
for(auto i:input)
13+
if(i!=n)
14+
input[index++]=i;
15+
return index;
16+
}
17+
};

0 commit comments

Comments
 (0)