Razorpay-inspired transaction-sequence model must not allow a prediction at position t to inspect events that occur later in the sequence. You need to construct the causal attention mask that blocks those future positions.
Build the lower-triangular boolean mask of size n×n: entry (i,j) is True when position i may look at position j, i.e. j≤i.
Implement solve(n).
Returns. Return an n×n boolean NumPy array.
Example 1
Input:
solve(3)
Output:
[[True, False, False], [True, True, False], [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.