clean code in java


  • 0
    L
    public int removeElement(int[] nums, int val) {
                    int i = 0, j = 0;
    		int len = nums.length;
    		while(j < len){
    			if(nums[j] == val){
    				j ++;
    			}else{
    				nums[i++] = nums[j++];
    			}		
    		}
    		return i;
        }
    

Log in to reply
 

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