{"size": 851, "ext": "js", "max_stars_repo_path": "Array/Find All Duplicates in an Array.js", "max_stars_repo_name": "jaymanale/Leetcode-Javascript", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Array/Find All Duplicates in an Array.js", "max_issues_repo_name": "jaymanale/Leetcode-Javascript", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Array/Find All Duplicates in an Array.js", "max_forks_repo_name": "jaymanale/Leetcode-Javascript", "max_forks_repo_forks_event_min_datetime": "2021-12-18T17:29:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-18T17:29:00.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 19.7906976744, "max_line_length": 70, "alphanum_fraction": 0.5193889542}
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var findDuplicates = function(nums) {
    var findDuplicates = function(nums) {
    
    nums = quick_Sort(nums);
    let prev = -Infinity,output = [];
        for(let num of nums){
         if(prev == num){
             output.push(num);
             }
         prev = num;
        }
    return output;
};


function quick_Sort(origArray) {
	if (origArray.length <= 1) { 
		return origArray;
	} else {

		var left = [];
		var right = [];
		var newArray = [];
		var pivot = origArray.pop();
		var length = origArray.length;

		for (var i = 0; i < length; i++) {
			if (origArray[i] <= pivot) {
				left.push(origArray[i]);
			} else {
				right.push(origArray[i]);
			}
		}

		return newArray.concat(quick_Sort(left), pivot, quick_Sort(right));
	}
}

};