Array.prototype.distinct = function(){ var self = this; var _a = this.concat().sort(); _a.sort(function(a,b){ if(a == b){ var n = self.indexOf(a); self.splice(n,1); } }); return self; };
?
据说,该方法算法复杂度O(1)
Array.prototype.distinct = function(){ var self = this; var _a = this.concat().sort(); _a.sort(function(a,b){ if(a == b){ var n = self.indexOf(a); self.splice(n,1); } }); return self; };
?
据说,该方法算法复杂度O(1)