Cognine interview question

Patterns(Print Z pattern based on num of astricks allowed) Strings