Search⌘ K
AI Features

Build a Matrix with Conditions

Build a Matrix with Conditions places numbers one through k exactly once in a square matrix, fills other cells with zeros, and follows row and column ordering rules, or returns empty if impossible.

Statement

You are given a positive integer ...