Alkesh Ghorpade
May 31, 2021

--

Hey Teodor,

Yes with ES6+ we can use the ability of a set.

The problem statement specifies without any extra space. A set when created in ES6+ will use extra memory and will take O(N) time. Converting a set back to array will add O(N) time.

The array here is small, imagine if we have to run the set logic on huge array.

--

--

Alkesh Ghorpade
Alkesh Ghorpade

Written by Alkesh Ghorpade

Software Engineer. Working ShakaCode. My portfolio https://alkeshghorpade.me

No responses yet