leetcode Remove Element

挺简单的,没什么好说的

public class Solution {
    public int removeElement(int[] A, int elem) {
        int j=0;
        for(int i=0;i<A.length;i++){
            if(A[i]!=elem){
                A[j]=A[i];
                j++;
            }
        }
        return j;
    }
}
原文地址:https://www.cnblogs.com/lilyfindjobs/p/4053883.html