class Solution { func convert(_ s: String, _ numRows: Int) -> String { var arr = [[Character?]](repeating: Array(repeating: nil, count: 1001), count: 1001) let str = Array(s) var row = 0 var col = 0 var phase: Phase = .down for ch in str { if row == 0 { phase = .down } else if row == numRows - 1 { phase = .up } arr[row][col] = ch if phase == .down { row += 1 } else { row -= 1 col += 1 } } var st..