UST interview question

Algorithm to print this star pattern