Java Solution beats 88% solutions


  • 0
    J
    if(nums.length==0 || nums.length==1)
        return false;
        Arrays.sort(nums);
        int check=0;
        for(int i=0;i<nums.length-1;i++){
    	
    		if(nums[i]==nums[i+1]) check=1;
    	}
    	if(check==0) return false;
    	else return true;

Log in to reply
 

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