Leetcode 27. Remove Element

来源:互联网 发布:淘宝举报假冒及盗版 编辑:程序博客网 时间:2024/05/16 06:18
public class Solution {    public int removeElement(int[] nums, int val) {        int idx = 0;                for (int num : nums)             if (num != val)                nums[idx++] = num;                        return idx;    }}

0 0
原创粉丝点击