Skip to content

Commit

Permalink
Fixing issue for " : Line 34: Char 22: error: value of type 'Int' has…
Browse files Browse the repository at this point in the history
… no member 'stride' "
  • Loading branch information
iHackSubhodip committed Jan 24, 2019
1 parent 4d03040 commit 1fa48a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Array/SpiralMatrix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

class SpiralMatrix {
func spiralOrder(matrix: [[Int]]) -> [Int] {
func spiralOrder(_ matrix: [[Int]]) -> [Int] {
var res = [Int]()

guard matrix.count != 0 else {
Expand Down Expand Up @@ -38,7 +38,7 @@ class SpiralMatrix {
}

// bottom
for i in endY.stride(through: startY, by: -1) {
for i in stride(from: endY, through: startY, by: -1) {
res.append(matrix[endX][i])
}
endX -= 1
Expand All @@ -47,7 +47,7 @@ class SpiralMatrix {
}

// left
for i in endX.stride(through: startX, by: -1) {
for i in stride(from: endX, through: startX, by: -1) {
res.append(matrix[i][startY])
}
startY += 1
Expand All @@ -58,4 +58,4 @@ class SpiralMatrix {

return res
}
}
}

0 comments on commit 1fa48a4

Please sign in to comment.