Who can tell me the problem of it


  • 0
    V

    class Solution {
    public int removeElement(int[] nums, int val) {
    for(int i=0;i<nums.length;i++)
    {
    if(nums[i] == val)
    {
    nums[i] = nums[nums.length-1];
    nums = Arrays.copyOf(nums, nums.length-1);
    i--;
    }
    }
    return nums.length;
    }
    }


  • 0
    V
    This post is deleted!

Log in to reply
 

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