Given an integer N, print an inverted isosceles triangle of stars such that the height of the triangle is N.
 
Example 1:
Input:
N = 4
Output:
*******
 *****
  ***
   *
Example 2:
Input:
N = 3
Output:
*****
 ***
  *
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function invIsoTriangle() which takes an Integer N as input and returns a vector of strings where each line represents lines of the pattern. For example, if N=2, the vector v = {"***", " * "}.
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
 
Constraints:
1 <= N <= 100

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3

class Solution:
    def invIsoTriangle(self, N):
        # code here 

Solutions:
class Solution:

	def invIsoTriangle(self, N):
		k = 0
		l = []
		s = N * 2 - 1
		for i in range(0, N):
			l.append(' ' * k + '*' * s)
			s = s - 2
			k = k + 1
		return l


class Solution:

	def invIsoTriangle(self, N):
		k1 = N + (N - 1)
		for x in range(N):
			for z in range(x):
				print(' ', end='')
			for y in range(k1):
				print('*', end='')
			for z in range(x):
				print(' ', end='')
			k1 -= 2
			print()
		return []


class Solution:

	def invIsoTriangle(self, N):
		ar = []
		for i in range(N):
			st = ''
			for j in range(i):
				st += ' '
			for j in range((N - i) * 2 - 1):
				st += '*'
			ar.append(st)
		return ar


class Solution:

	def invIsoTriangle(self, n):
		l = []
		for i in range(n, 0, -1):
			l.append(' ' * (n - i) + '*' * (2 * i - 1))
		return l


class Solution:

	def invIsoTriangle(self, N):
		l = []
		var = ''
		for j in range(N, 0, -1):
			string = ''
			for i in range(2 * j - 1, 0, -1):
				string += '*'
			l.append(var + string + var)
			var += ' '
		return l


class Solution:

	def invIsoTriangle(self, N):
		for i in range(1, N + 1):
			if i == 1:
				for j in range(2 * (N - i) + 1):
					print('*', end='')
			else:
				for x in range(i - 1):
					print(' ', end='')
				for y in range(2 * (N - i) + 1):
					print('*', end='')
				for z in range(i - 1):
					print(' ', end='')
			print()
		return ''


class Solution:

	def invIsoTriangle(self, N):
		a = []
		for i in range(N):
			s = ''
			for j in range(i):
				s = s + ' '
			for k in range(2 * (N - i) - 1):
				s = s + '*'
			for j in range(i):
				s = s + ' '
			a.append(s)
		return a


class Solution:

	def invIsoTriangle(self, N):
		s2 = []
		for i in range(1, N + 1):
			s1 = ''
			for j in range(1, 2 * N):
				if j >= 0 + i and j <= 2 * N - i:
					s1 += '*'
				else:
					s1 += ' '
			s2.append(s1)
		return s2


class Solution:

	def invIsoTriangle(self, n):
		a = []
		for i in range(n):
			x = ''
			for j in range(0, i):
				x += ' '
			for j in range(0, 2 * (n - i) - 1):
				x += '*'
			for j in range(0, i):
				x += ' '
			a.append(x)
		return a


class Solution:

	def invIsoTriangle(self, n):
		a = n - 1
		a = a + n
		l = []
		for i in range(n):
			b = ' ' * i + '*' * a
			l += [b]
			a -= 2
		return l


class Solution:

	def invIsoTriangle(self, N):
		e = []
		n = 2 * N - 1
		for i in range(N):
			s = ' ' * i
			for j in range(n, 0, -1):
				s += '*'
			s += ' ' * i
			e += [s]
			n -= 2
		return e


class Solution:

	def invIsoTriangle(self, N):
		s = 0
		s1 = 2 * N - 1
		l = ''
		l1 = []
		for i in range(N):
			for j in range(s):
				l += ' '
			for j in range(s1):
				l += '*'
			s = s + 1
			s1 = s1 - 2
			l1.append(l)
			l = ''
		return l1


class Solution:

	def invIsoTriangle(self, N):
		tl = []
		for i in range(N):
			x = N - i
			x += x - 1
			temp = ' ' * i + '*' * x + ' ' * i
			tl.append(temp)
		return tl


class Solution:

	def invIsoTriangle(self, N):
		n = N
		num_space = 0
		my_list = []
		cur_str = ''
		for i in range(n):
			cur_str = ' ' * num_space + '*' * (n * 2 - 1) + ' ' * num_space
			my_list.append(cur_str)
			num_space = num_space + 1
			n = n - 1
		return my_list


class Solution:

	def invIsoTriangle(self, N):
		for i in range(N, 0, -1):
			for j in range(N - i):
				print(' ', end='')
			for j in range(2 * i - 1):
				print('*', end='')
			for z in range(N - i):
				print(' ', end='')
			print()
		return ''


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(N):
			s = ''
			for j in range(2 * N - 1):
				if j < i or j >= 2 * N - 1 - i:
					s = s + ' '
				else:
					s = s + '*'
			ans.append(s)
		return ans


class Solution:

	def invIsoTriangle(self, n):
		k = n + n - 3
		b = []
		f = 1
		s = ''
		s += '*' * (k + 2)
		b.append(s)
		for i in range(1, n):
			s = ''
			for t in range(f):
				s += ' '
			for j in range(k):
				s += '*'
			for t in range(f):
				s += ' '
			f += 1
			b.append(s)
			k -= 2
		return b


class Solution:

	def invIsoTriangle(self, N):
		l = []
		for i in range(N):
			l.append(' ' * i + '*' * (2 * (N - i) - 1) + ' ' * i)
		return l


class Solution:

	def invIsoTriangle(self, N):
		n = 2 * N - 1
		a = []
		for i in range(0, N):
			b = i * ' ' + '*' * n + i * ' '
			a.append(b)
			n = n - 2
		return a


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(N, 0, -1):
			a = ''
			a += ' ' * (N - i)
			a += '*' * (2 * i - 1)
			a += ' ' * (N - i)
			ans.append(a)
		return ans


class Solution:

	def invIsoTriangle(self, n):
		output = []
		pt = '*'
		k = (n - 1) * 2 + 1
		for x in range(n - 1, -1, -1):
			p = pt * (x * 2 + 1)
			sp = k - len(p)
			sp = sp // 2
			pref = ' ' * sp
			output.append(pref + p + pref)
		return output


class Solution:

	def invIsoTriangle(self, N):
		l = list()
		val = 2 * N - 1
		for i in range(N, 0, -1):
			str = ''
			for j in range(0, N - i):
				str = str + ' '
			for k in range(val, 0, -1):
				str = str + '*'
			for j in range(0, N - i):
				str = str + ' '
			val = val - 2
			l.append(str)
		return l


class Solution:

	def invIsoTriangle(self, N):
		l = []
		j = 1
		a = N - 1
		for i in range(1, N + 1):
			x = ' ' * a + '*' * j + ' ' * a
			l.append(x)
			j += 2
			a -= 1
		return l[::-1]


class Solution:

	def invIsoTriangle(self, N):
		lista = []
		for i in range(N):
			res = ''
			for j in range(i):
				res += ' '
			k = 2 * (N - i) - 1
			for j in range(k):
				res += '*'
			for j in range(i):
				res += ' '
			lista.append(res)
		return lista


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		maxStars = 2 * N - 1
		space = 0
		while maxStars > 0:
			a = ''
			for i in range(space):
				a += ' '
			for i in range(maxStars):
				a += '*'
			for i in range(space):
				a += ' '
			maxStars -= 2
			space += 1
			ans.append(a)
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		ans = ob.invIsoTriangle(N)
		for i in ans:
			print(i)


class Solution:

	def invIsoTriangle(self, N):
		for i in range(1, N + 1):
			if i == 1:
				for j in range(2 * (N - i) + 1):
					print('*', end='')
			else:
				for x in range(i - 1):
					print(' ', end='')
				for y in range(2 * (N - i) + 1):
					print('*', end='')
				for z in range(i - 1):
					print(' ', end='')
			print()
		return ''
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		ans = ob.invIsoTriangle(N)
		for i in ans:
			print(i)


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(N):
			p = ''
			for j in range(i):
				p += ' '
			for j in range(2 * (N - i) - 1):
				p += '*'
			ans.append(p)
		return ans


class Solution:

	def invIsoTriangle(self, N):
		k = 0
		arr = []
		for i in range(N, 0, -1):
			j = i * 2 - 1
			arr.append(' ' * k + '*' * j)
			k += 1
		return arr


class Solution:

	def invIsoTriangle(self, N):
		list = []
		for i in range(1, N + 1):
			str = ''
			str = str + (i - 1) * ' '
			n = 2 * N - 1 - 2 * (i - 1)
			str = str + n * '*'
			str = str + (i - 1) * ' '
			list.append(str)
		return list


class Solution:

	def invIsoTriangle(self, N):
		a = []
		for i in range(0, N):
			s = ''
			for j in range(2 * N - 1):
				if min(2 * N - 2 - j, j) < i:
					print(' ', end='')
				else:
					print('*', end='')
			print()
		return a


class Solution:

	def invIsoTriangle(self, n):
		ans = []
		for i in range(n):
			s = ''
			for j in range(2 * n - 1):
				if min(2 * n - 2 - j, j) < i:
					print(' ', end='')
				else:
					print('*', end='')
			print()
		return ans


class Solution:

	def invIsoTriangle(self, N):
		k = 0
		for i in range(N, 0, -1):
			j = i * 2 - 1
			print(' ' * k + '*' * j)
			k += 1
		return ''


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(N):
			temp = ''
			for s in range(i):
				temp += ' '
			for s in range(N * 2 - 1 - 2 * i):
				temp += '*'
			for s in range(i):
				temp += ' '
			ans.append(temp)
		return ans


class Solution:

	def invIsoTriangle(self, N):
		lst = []
		for i in range(N, 0, -1):
			lst.append(' ' * (N - i) + '*' * (2 * i - 1))
		return lst


class Solution:

	def invIsoTriangle(self, N):
		i = 0
		s = 2 * N - 1
		res = []
		while i < N:
			st = []
			for k in range(i):
				st.append(' ')
			for j in range(i, s - i):
				st.append('*')
			res.append(''.join(st))
			i += 1
		return res


class Solution:

	def invIsoTriangle(self, N):
		for i in range(N):
			for s in range(i):
				print(' ', end='')
			for j in range(2 * N - 2 * i - 1):
				print('*', end='')
			print()
		return ''


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(1, N + 1):
			s = ''
			if i == 1:
				for j in range(2 * (N - i) + 1):
					s += '*'
			else:
				for X in range(i - 1):
					s += ' '
				for y in range(2 * (N - i) + 1):
					s += '*'
				for Z in range(i - 1):
					s += ' '
			ans.append(s)
		return ans


class Solution:

	def invIsoTriangle(self, N):
		rows = N
		s = ''
		a = []
		for i in range(rows, 0, -1):
			for j in range(1, 2 * rows):
				if rows - i < j < rows + i:
					s += '*'
				else:
					s += ' '
			a.append(s)
			s = ''
		return a


class Solution:

	def invIsoTriangle(self, N):
		ans = []
		for i in range(1, N + 1):
			s = ''
			if i == 1:
				for j in range(2 * (N - i) + 1):
					s += '*'
			else:
				for x in range(i - 1):
					s += ' '
				for y in range(2 * (N - i) + 1):
					s += '*'
				for z in range(i - 1):
					s += ' '
			ans.append(s)
		return ans