设为首页 加入收藏

TOP

leetcode_27_Remove Element
2015-07-20 17:17:22 来源: 作者: 【 】 浏览:3
Tags:leetcode_27_Remove Element

?

?

?

Remove Element

?

Given an array and a value, remove all instances of that value in place and return the new length.


The order of elements can be changed. It doesn't matter what you leave beyond the new length.

?

?

//vs2012测试
#include
  
   
#include
   
     using namespace std; #define n 2 int main() { int A[n]; int elem; for(int i=0; i
    
     >A[i]; } cin>>elem; int start = 0; for(int i=0; i
     
      
//方法一:自测Accepted
class Solution {
    
public:
    int removeElement(int A[], int n, int elem) {
	int length = 0;
	for(int i=0; i
       





       
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇uva -10129 - Play on Words 下一篇UVA 657-The die is cast(dfs*2)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)