Submission Result: Time Limit Exceeded, I don't know what to do


  • 0
    1
    var findDisappearedNumbers = function(nums) {
    	var newArr=[];
        
        
    	for(var i=1; i<=nums.length; i++){
    		if (nums.indexOf(i) === -1) {
                newArr.push(i);
                
            } 
    	}	
    	return newArr;
    };

Log in to reply
 

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