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.
- Prepare
- Python
- Math
- Triangle Quest 2
- Discussions
Triangle Quest 2
Triangle Quest 2
Sort by
recency
|
1121 Discussions
|
Please Login in order to post a comment
Asked for one print statment Asked for on for loop
I'm this close to loosing it with hackerank
Asked for one print statment Asked for on for loop
I'm this close to loosing it with hackerank
this is my solution:
for i in range(1,int(input())+1): print((111111111//10**(9-i))**2)
for i in range(1, int(input())+1): print((10**i // 9)**2)
It's a simple math problem:
First, recognize the palindrome has this format: 1 * 1 = 1 11*11 = 121 111*111 = 12321
Second, create a formula with a given value of N ((10**N) - 1) // 9
Now you can square the formula by 2