I am trying to submit a problem, whose question is mentioned below:
You are given all numbers between 1,2,…,n except one. Your task is to find the missing number.
The first input line contains an integer n.
The second line contains n−1 numbers. Each number is distinct and between 1 and n (inclusive).
Print the missing number.
2 3 1 5
My Solution( In Python):
l = 
n = int(input())
l = [int(item) for item in input().split()]
for i in range(1,n):
if i in l:
I am getting a TLE error in some of the test cases, due to which I’m unable to submit it. Though, it has passed all the other test cases successfully.
Any help or guidance would be appreciated