DEV Community

Discussion on: Are these lists equal?

Collapse
 
unmultimedio profile image
Julian R Figueroa • Edited

I like a lot these kinds of exercises, very nice diagrams and a way to explain it!

Did you know it can be solved with just one frequency map by adding/removing the key? Same O(n), but two-thirds of the operations and half the memory :)

Check (and run) this snippet: play.golang.org/p/ZR5QHwZPAn8

This is only valid because of:

You can assume that there's no duplicate item in any of the lists.

Very cool articles man! 🚀

Collapse
 
caroso1222 profile image
Carlos Roso

Thanks mate! Your support is always much appreciated 🙏🏼

You got a point, yeah! Much more performant in time and space indeed.