inspiration of Move Zeros283.


  • 0
    W

    public class Solution {
    public int removeElement(int[] nums, int val) {
    int count = 0;
    for(int num:nums){
    if(num != val)nums[count++] = num;
    }
    return count;
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.