Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Dedupe an array in javascript

Input : An array
Output : An array

Logic :

  • Iterate over the input array called data
  • Add the element to the output array called result if the element does not exist in the output array
  • Return the output array

Time complexity : O(n) ; where n is the string length
Space complexity : O(1) ; constant

Solution :

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *