remove duplicates from an array
2022年5月1日小于 1 分钟
remove duplicates from an array
Question
Given an array containing all kinds of data, please implement a function deduplicate()
to remove the duplicates.
You should modify the array in place. Order doesn't matter.
What is time & space cost of your approach?
Code
/**
* @param {any[]} arr
*/
function deduplicate(arr) {
// your code here
}