Intersection of Two Arrays - Leetcode 349 - Python

preview_player
Показать описание


0:00 - Read the problem
0:52 - Drawing Explanation
3:10 - Coding Explanation

leetcode 349

#neetcode #leetcode #python
Рекомендации по теме
Комментарии
Автор

You're like the last few pages of the book that gives all the answers

CodingThingsIRL
Автор

When I solved this issue on my own I didn't come to the idea of delete item from set. It's very graceful move. Thank you!

samatzhetibaev
Автор

Hello!!!
Could you please make a video series on CSES Problem Set?

firefly_
Автор

Since the input size and range are small, this is easier and more efficient:

def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
arr = [0] * 1001
res = []
for n in nums1:
arr[n] = 1
for n in nums2:
if arr[n] == 1:
res.append(n)
arr[n] = 0
return res

junwang
Автор

Neethcode bro where are from last 2 days. I need some videos for last 2 problems pls
Thnx in advance

Kiyotaka-ml
Автор

Sir you didn't upload today's streak question solution😢

SAIGOVINDSATISH
Автор

Is it possible to buy premium from Europe ? Will entering US address and buying via Cash App work ?

bartosz.
Автор

I wonder if my solution in Swift would be accepted by an interviewer 

let set1 = Set(nums1)
let set2 = Set(nums2)
return


it is still O(n)

DenisBrilliantov
Автор

Most optimal solutionfor Rust was just take two sets of those two input vectors and just call intersect

DeathSugar
Автор

Can't we just convert them to 2 sets and perform & over them
like
return set(nums1) & set(nums2)

barathkandapan
Автор

1 - row solution : ) Like is guaranted

Munchen
Автор

I got a faster time by breaking out early when the set is empty.

juanmacias
Автор

How come he sees the cnt of dislikes, if that premium only is yes then that's absurd lmfaooo 1:08

kanishkkala
Автор

Bro, what happened to you? You literally died for 4 days

unknown-utqn
Автор

Brother, teach design patterns for free

SanjayChandramohan-lqwp