File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Find_NumberS_Disappeared _Array Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ ##==================================
2+ ## Leetcode
3+ ## Student: Vandit Jyotindra Gajjar
4+ ## Year: 2020
5+ ## Problem: 448
6+ ## Problem Name: Final All Numbers Disappeared in an Array
7+ ##===================================
8+ #
9+ #Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array),
10+ #some elements appear twice and others appear once.
11+ #
12+ #Find all the elements of [1, n] inclusive that do not appear in this array.
13+ #
14+ #Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space.
15+ #
16+ #Example:
17+ #
18+ #Input:
19+ #[4,3,2,7,8,2,3,1]
20+ #
21+ #Output:
22+ #[5,6]
23+ class Solution :
24+ def findDisappearedNumbers (self , nums ):
25+ return list (set ([i for i in range (1 , len (nums ) + 1 , 1 )]) - set (nums )) #Return the disappeared numbers
You can’t perform that action at this time.
0 commit comments