3 line javascript solution


  • 0
    Z
    var rtn = new Array(0), s = new Set(nums);
    for(var i = 1; i <= nums.length; i++) if(!s.has(i)) rtn.push(i);
    return rtn;

Log in to reply
 

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