Help me in solving FACEBOOK problem

My issue

please some one help me in this

My code

t = int(input())
for i in range(t):
    n = int(input())
    a = list(map(int , input().split()))
    b = list(map(int , input().split()))
    c = max(a)
    e =max(b)
    d=a.count(c)
    f=0
    g=0
    for k in range(n):
        f =b.index(e)
        if d==1:
            f=a.index(c)
            g=a.index(c)+1
        elif d!=1:
            for j in range(f):
                g = b.index(e)+1 
    print(g)
            
            
            
            
            
    
                
                
                
        
            
            
        
        
        

Learning course: Sorting using Python
Problem Link: CodeChef: Practical coding for everyone

@as4460486
for test case
1
3
1 1 1
3 1 2
your output is
0
but the correct answer would be
1

@dpcoder_007
no correct answer is 3

@as4460486
No bro see the like are same that is 1,1,1.
So now we will check comments and the maximum comments comes on post 1st that is 3.
So 1 will be the answer

1 Like

@dpcoder_007
but for my case it is showing
122
312
in this likes of index1,2 are same
but the comments on post index 3 are the greatest
so when i am debugging my code its printing out righ answer is 3
and my output is 1

image

@as4460486
yeah that’s what i’m saying u r missing that case when the maximum likes are same and then u have to compare the comments .

1 Like