Today we will solve "Contains Duplicate" problem from #leetcode. This question has been asked by #google , #facebook (#meta), #amazon, #apple , #bloomberg , #microsoft , #adobe, and so many other companies.
We will use 3 solutions: one by using a hashmap, second by using a set and last one by sorting the input array to tackle this problem.
Give this problem a shot at here: https://leetcode.com/problems/contains-duplicate/description/
Don't miss Arrays playlist at here: https://www.youtube.com/watch?v=pB8Ypys-llM&list=PLAtZcLSBX7j8bozcHUo9-j4iGhvqsMDr-
Please check the channel page for more #leetcode solution videos. Also don't forget to like, comment, and subscribe. Hope you enjoy the video!
Chapters:
0:00 Intro and question
0:18 Examples
0:35 Brute-force solution
0:46 Hash map Solution
1:11 Set Solution
1:41 Sort Solution
2:24 Code walk through for all solutions
4:20 Time and Space Complexity