everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
9 lines (8 loc) • 395 B
TypeScript
/**
* Builds a square matrix of size n x n filled with numbers in spiral order.
* For example, spiralNumberMatrix(3) returns [[1,2,3],[8,9,4],[7,6,5]].
* @author @dailker
* @param {number} n - The size of the matrix (number of rows and columns).
* @returns {number[][]} The n x n matrix filled in spiral order.
*/
export declare function spiralNumberMatrix(n: number): number[][];