1 2 3 4 5 6 7 8 9 10 11
public class Solution { public int removeElement(int[] nums, int val) { int available = 0; for (int i = 0; i < nums.length; i++){ if (nums[i] != val){ nums[available++] = nums[i]; } } return available; } }
No comments:
Post a Comment