Skip to content

Commit 1106c88

Browse files
committed
Adding Modified Bad Solution - Problem - 448 - Find Numbers Disappeared Array
1 parent e84b5ac commit 1106c88

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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

0 commit comments

Comments
 (0)