We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
n=int(input())
q=input()
q1=q.split(" ")
x=""
for q2 in q1:
x=x+q2
a1=list(x)
s=""
l=len(a1)
for i in range((10(l-1)),(10l)):
sq=1
s=""
sq1=[]
sq=i*i
sq1=list(str(sq))
for j in range(0,(len(sq1)),2):
s=s+sq1[j]
if s == x:
print(i)
break**
My solution passed 16 test cases only. Rest all the cases aborted due to timeout. Any suggestions to reduce calculation time. My code is in python.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #206: Concealed Square
You are viewing a single comment's thread. Return to all comments →
n=int(input()) q=input() q1=q.split(" ") x="" for q2 in q1: x=x+q2 a1=list(x) s="" l=len(a1) for i in range((10(l-1)),(10l)): sq=1 s="" sq1=[] sq=i*i sq1=list(str(sq)) for j in range(0,(len(sq1)),2): s=s+sq1[j] if s == x: print(i) break**
My solution passed 16 test cases only. Rest all the cases aborted due to timeout. Any suggestions to reduce calculation time. My code is in python.