Hackerblocks: https://hack.codingblocks.com/contests/c/254/1272
My code: https://ide.codingblocks.com/s/70026
The constrains are given as:
1<=t<=100
1<=n<=100
But when i type n>30 it takes a lot of time only with 1 test case… but still got accepted on HB.
How do i optimize my algorithm?