diff options
Diffstat (limited to 'spiral_matrix.cpp')
-rw-r--r-- | spiral_matrix.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spiral_matrix.cpp b/spiral_matrix.cpp index ac1d212..d1c294b 100644 --- a/spiral_matrix.cpp +++ b/spiral_matrix.cpp @@ -5,8 +5,8 @@ class Solution { public: - vector<int> spiralOrder(vvd(int) & matrix) { - vvd(int) dirs{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; + vector<int> spiralOrder(vvd & matrix) { + vvd dirs{{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; int rows = matrix.size(), cols = matrix[0].size(); vector<int> ans, n_step{cols, rows - 1}; if (!rows || !cols) @@ -27,8 +27,8 @@ public: int main() { Solution obj; - vvd(int) m1 = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; - vvd(int) m2 = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; + vvd m1 = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; + vvd m2 = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}; for (auto i : obj.spiralOrder(m1)) printf("%d, ", i); printf("\n"); // expect: 1,2,3,6,9,8,7,4,5 |