The day 6 problem in August Leetcoding Challenge. ( Find All Duplicates in an Array ).
Check out our other popular playlists:
✅✅✅[ July Leetcoding Challenges ] : • July LeetCoding Challenge 2020
✅✅✅[ Cracking the Coding Interview - Unique String ] : • Cracking the Coding Interview - Unique String
✅✅✅[ June Leetcoding Challenges ] : • June LeetCoding Challenge 2020
✅✅✅[ May Leetcoding challenges ]: • May LeetCoding Challenge 2020
0:00 Find All Duplicates in an Array
0:38 Brute Force Apporach
1:18 Sort and compare adjacent elements
2:00 Store seen elements in Set/map/array.
3:15 Mark visited elements in input array itself
5:46 Mark visited elements in input array itself - Single Pass
Problem Link: https://leetcode.com/problems/find-al...
Problem statement:
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
Could you do it without extra space and in O(n) runtime?
Example:
Input:
[4,3,2,7,8,2,3,1]
Output:
[2,3]
If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.
Code Link: https://github.com/Algorithms-Made-Ea...
#coding #interview #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode