Build the causal (look-ahead) mask for a sequence of length n: a boolean n×n matrix whose entry (i,j) is True when position i may attend to position j, i.e. when j≤i.
Implement solve(n).
Returns. Return a lower-triangular boolean NumPy array (diagonal included).
Example 1
Input:
solve(4)
Output:
[[True, False, False, False], [True, True, False, False], [True, True, True, False], [True, True, True, True]]
Example 2
Input:
solve(1)
Output:
[[True]]
No results yet
Run your code to check it against the examples, or submit to run every test.