Given an integer N. Your task is to identify the pattern from the Examples and print the pattern.
 
Example 1: 
Input:
N = 4
Output:
4444444 
4333334 
4322234 
4321234 
4322234 
4333334 
4444444
Example 2: 
Input:
N = 3
Output:
33333 
32223 
32123 
32223 
33333
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function interestingPattern() which takes an Integer N as input and returns a vector of strings where each line representins each line of the pattern. For example, if N = 3, you have to return a vector v = {"33333", "32223", "32123", "32223", "33333"}.
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
 
Constraints:
1 <= N < 10

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3

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

Solutions:
class Solution:

	def interestingPattern(self, N):
		l = []
		if N == 1:
			return '1' + '\n'
		for i in range(N, 0, -1):
			s = '' + str(N)
			k = N
			for j in range(0, N - i):
				k = k - 1
				s = s + str(k)
			s = s + (i - 1) * str(k)
			r = s[::-1]
			s = s + r[1:]
			l.append(s + '\n')
		l = l + l[::-1][1:]
		return ''.join(l)


class Solution:

	def interestingPattern(self, N):
		an = []
		for i in range(N):
			l = []
			for j in range(2 * N - 1):
				l.append(N)
			an.append(l)
		l = 1
		r = 2 * N - 2
		i = 1
		while l <= r:
			for k in range(0, l):
				an[i][k] = an[i - 1][k]
			for k in range(l, r):
				an[i][k] = an[i - 1][k] - 1
			for k in range(r, 2 * N - 1):
				an[i][k] = an[i - 1][k]
			l += 1
			r -= 1
			i += 1
		for i in range(N - 2, -1, -1):
			an.append(an[i])
		f_an = ''
		for i in an:
			for j in i:
				f_an += str(j)
			f_an = f_an + '\n'
		return f_an


class Solution:

	def interestingPattern(self, N):
		size = 2 * N - 1
		arr = [[0] * size for i in range(size)]
		for i in range(0, N):
			for j in range(i, size - i):
				arr[i][j] = N - i
				arr[size - i - 1][j] = N - i
				arr[j][i] = N - i
				arr[j][size - i - 1] = N - i
		return ''.join([''.join([str(j) for j in i]) + '\n' for i in arr])


class Solution:

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


class Solution:

	def interestingPattern(self, n):
		for i in range(1, 2 * n):
			for j in range(1, 2 * n):
				(l, r, t, b) = (i, j, 2 * n - i, 2 * n - j)
				print(n - min(l, r, t, b) + 1, end='')
			print()
		return ''


class Solution:

	def interestingPattern(self, n):
		l = []
		for i in range(2 * n - 1):
			s = ''
			for j in range(2 * n - 1):
				k = min(i, j, 2 * n - i - 2, 2 * n - j - 2)
				s += str(n - k)
			print(s)
		return ''


class Solution:

	def interestingPattern(self, t):
		a = []
		for i in range(1, t * 2):
			temp = ''
			for j in range(1, 2 * t):
				inner = max(abs(t - i), abs(t - j)) + 1
				temp += str(inner)
			print(temp)
		return ''


class Solution:

	def interestingPattern(self, N):
		l = []
		for i in range(1, N * 2):
			temp = ''
			for j in range(1, 2 * N):
				inner = max(abs(N - i), abs(N - j)) + 1
				temp += str(inner)
			print(temp)
		return ''


class Solution:

	def interestingPattern(self, N):
		v = []
		i = 1
		while i <= 2 * N - 1:
			s = ''
			j = 1
			while j <= 2 * N - 1:
				k = max(abs(i - N), abs(j - N)) + 1
				s += str(k)
				j += 1
			print(s)
			i += 1
		return ''


class Solution:

	def interestingPattern(self, N):
		a = ['' for _ in range(2 * N - 1)]
		for i in range(1, 2 * N):
			s = ''
			for j in range(1, 2 * N):
				k = max(abs(i - N), abs(j - N)) + 1
				s += str(k)
			a[i - 1] = s
		for i in range(2 * N - 1):
			print(a[i])
		return ''


class Solution:

	def interestingPattern(self, N):
		e = (2 * N - 1) * str(N)
		l = [e]
		d = N - 1
		g = 2 * N - 1
		for i in range(1, N):
			t = l[-1][:i] + (g - 2 * i) * str(d) + l[-1][g - i:]
			l.append(t)
			d = d - 1
		c = len(l)
		for i in l:
			print(i)
		for i in range(c - 2, -1, -1):
			print(l[i])
		return ''


class Solution:

	def interestingPattern(self, N):
		v = []
		i = 1
		while i <= 2 * N - 1:
			s = ''
			j = 1
			while j <= 2 * N - 1:
				k = max(abs(i - N), abs(j - N)) + 1
				s += str(k)
				j += 1
			print(s)
			i += 1
		return ''
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.interestingPattern(N), end='')


class Solution:

	def interestingPattern(self, n):
		n = 2 * n - 1
		for i in range(n):
			for j in range(n):
				print((n + 1) // 2 - min(i, j, n - i - 1, n - j - 1), end='')
			print()
		return ''


from numpy import array

class Solution:

	def interestingPattern(self, N):
		a = []
		for i in range(1, N * 2):
			t = ''
			for j in range(1, N * 2):
				t += str(max(abs(N - i), abs(N - j)) + 1)
			print(t)
		return ''


class Solution:

	def interestingPattern(self, N):
		arr = ''
		for i in range(1, N + 1):
			k = N
			a = ''
			for j in range(1, i + 1):
				a += str(k)
				k -= 1
			for j in range(i + 1, 2 * N - i + 1):
				a += str(N - i + 1)
			k = N - i + 2
			for j in range(2 * N - i + 1, 2 * N):
				a += str(k)
				k += 1
			arr += a
			arr += '\n'
		for i in range(1, N):
			k = N
			a = ''
			for j in range(1, N - i + 1):
				a += str(k)
				k = k - 1
			for j in range(N - i + 1, N + i + 1):
				a += str(i + 1)
			k = i + 2
			for j in range(N + i + 1, 2 * N):
				a += str(k)
				k = k + 1
			arr += a
			arr += '\n'
		return arr