UST Interview Question

Algorithm to print this star pattern