Free written solution

Spiral Matrix IV (LeetCode 2326): Solution and Explanation

Given the size m x n of a matrix and the head of a linked list, write the list values into the matrix in clockwise spiral order from the top-left corner and fill any cells left over with -1.

Read the intuition, approach, code and complexity →