设为首页 加入收藏

TOP

leetcode_27_Remove Element
2015-07-20 17:17:22 来源: 作者: 【 】 浏览:4
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)

评论

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

·Redis压力测试实战 - (2025-12-27 09:20:24)
·高并发一上来,微服 (2025-12-27 09:20:21)
·Redis 高可用架构深 (2025-12-27 09:20:18)
·Linux 系统监控 的完 (2025-12-27 08:52:29)
·一口气总结,25 个 L (2025-12-27 08:52:27)