标签:
原题链接:https://oj.leetcode.com/problems/remove-element/
很简单一道题。。。
class Solution { public: int removeElement(int A[], int n, int elem) { int front = 0; int idx = 0; while (idx < n) { if (A[idx] != elem) { A[front] = A[idx]; ++front; } ++idx; } return front; } };
[Leetcode] 27 - Remove Element
标签:
原文地址:http://blog.csdn.net/algorithmengine/article/details/43196595