Your question is Generate Star Patterns and Arrays. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Ascentt interview utilities may need to format simple visual output and reshape two-dimensional data. Write a function that generates a left-aligned growing star pattern and returns the transpose of a rectangular matrix.
For an integer n, the pattern must contain n strings. The string at position i must contain exactly i + 1 asterisks, with no spaces between them. For a matrix with r rows and c columns, the transposed matrix must have c rows and r columns. Element (i, j) in the original matrix must appear at (j, i) in the result.
Implement build_pattern_and_transpose(n, matrix).
n, a positive integer, and matrix, a non-empty rectangular two-dimensional list of integers.pattern: a list of strings representing the star pattern.transpose: a two-dimensional list containing the transposed matrix.def build_pattern_and_transpose(n, matrix):