Carlos Ruiz
1 min readFeb 6, 2020

--

One of the optimal solutions is to use a Map where you do O(n) to populate de map – then you iterate over second array and find if any element exist … In theory maps have no access O(1) guaranteed but I’m practice you can assume that leaving your best case to O(n)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Carlos Ruiz
Carlos Ruiz

Written by Carlos Ruiz

Coffee lover (serious espresso drinker)

No responses yet

Write a response