/* t: O(n), s: O(1)*/classSolution {publicintremoveElement(int[] nums,int val) {// because this problem only need to know the length of array after removing element// so use a index to record the left elementint begin =0;for (int num : nums) {if (num != val) { nums[begin++] = num; } }return begin; }}