Merilytics interview question

Given a star pattern, write code to print the same.