inp = list(map(int,input().split()))
for i in range(len(inp)):
for j in range(i+1,len(inp)):
if(len(sub)==0 or len(sub)==len(inp)):
for k in sub:
for i in l:
for input: 1 4 3 1 2 2 3 output for my code is: 2 but other code the output is 1 what wrong with my code.
Your logic is wrong and another mistake you are doing is use brute force if I am right. You can go through editorial of this question. As you haven’t provided question’s link I think it is MGCSET.