You are viewing a single comment's thread. Return to all comments →
N=int(input()); [print((10**i //9)**2) for i in range(1,N+1)]
N,a,k=int(input()),'',[] ;[k.append(a:=a+f'{i}') or print(a+k[i-2][::-1] if i>1 else i) for i in range(1,N+1)]
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Triangle Quest 2
You are viewing a single comment's thread. Return to all comments →
simpler using maths
N=int(input()); [print((10**i //9)**2) for i in range(1,N+1)]
or by strings
N,a,k=int(input()),'',[] ;[k.append(a:=a+f'{i}') or print(a+k[i-2][::-1] if i>1 else i) for i in range(1,N+1)]