You are viewing a single comment's thread. Return to all comments →
i tried above ideas in my python code....but i am getting a time out for test cases 4- 30 can anybody please help me
n1,n2,n3 = raw_input().strip().split(' ') n1,n2,n3 = [int(n1),int(n2),int(n3)] h1 = map(int,raw_input().strip().split(' '))[::-1] h2 = map(int,raw_input().strip().split(' '))[::-1] h3 = map(int,raw_input().strip().split(' '))[::-1] h1 = [sum(h1[:i+1]) for i in range(len(h1))] h2 = [sum(h2[:i+1]) for i in range(len(h2))] h3 = [sum(h3[:i+1]) for i in range(len(h3))] while h1[-1] != h2[-1] or h2[-1] != h3[-1]: if h1[-1] > h2[-1] or h1[-1] > h3[-1]: h1.pop() elif h2[-1] > h1[-1] or h2[-1] > h3[-1]: h2.pop() elif h3[-1] > h2[-1] or h3[-1] > h1[-1]: h3.pop() print h1[-1]
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
i tried above ideas in my python code....but i am getting a time out for test cases 4- 30 can anybody please help me