Answers for "deleting duplicates from unsorted array in n^2"

1

completely remove duplicate element from the array

var array = [1, 2, 3, 4, 4, 5, 5],
    result = array.filter(function (v, _, a) {
        return a.indexOf(v) === a.lastIndexOf(v);
    });

console.log(result); // [1, 2, 3]
Posted by: Guest on March-29-2022
0

remove duplicates from sorted array

def remove_duplicate(nums: [int]) -> int:
  nums[:] = sorted(set(nums))
  return len(nums)
Posted by: Guest on December-29-2020

Code answers related to "deleting duplicates from unsorted array in n^2"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language