Interview Shuriken 55: Missing Numbers
Given an unsorted array of integers of size n, having elements ranging from 1 to n (number of elements). The array may have repetitive elements, hence some numbers in the range are missing from the array. Find and print those numbers.
Input Format:
Constraints:
Output Format:
Sample Input 1:
Sample Output 1:
Explanation:
Missing numbers between range of 1 to 7 are 5 and 6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr=list(map(int,input().split())) | |
res=set(arr[1:]) | |
[print(i,end=" ") for i in range(1,arr[0]+1) if i not in res] |
Comments
Post a Comment
Please give us your valuable feedback