Cant get the algo

please explain the algo behind this problem i am not getting and give code for reference

@prajwalsingh226_b93d74431f6edd96 hi, you have breakdown the pattern in diff parts
upper Half (i=0 to n-1)
print some space first(n-i)
then print num in increasing order from i+1 to 2i+1
then print num in dec order from 2i to i+1

to print lower half reverse the upper half
start loop from n-2 till 0

check the reference code
Reference Code