The problem is wrong..


  • 0
    G

    The method returns the length but it check the int[];
    my solution:

    public int removeDuplicates(int[] nums) {
    		int result = nums.length;
            for(int i = 0; i < nums.length - 1; i++){
            	if(nums[i] == nums[i+1]){
            		result--;
            	}
            }
            return result;
        }
    

Log in to reply
 

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