class Solution { public int removeElement(int[] nums, int val) { int slow = 0,fast = 0,n = nums.length; while(fast < n){ if(nums[fast] != val){ nums[slow] = nums[fast]; slow++; } fast++; } return slow; } }
京公网安备 11010502049817号