All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0001_0100.s0006_zigzag_conversion.Solution.swift Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
// #Medium #String #2024_06_19_Time_26_ms_(72.18%)_Space_16.6_MB_(44.74%)

class Solution {
    func convert(_ s: String, _ numRows: Int) -> String {
        let arr = Array(s)
        var result = ""
        let shift = numRows > 1 ? (numRows - 1) * 2 : 1
        var index = 0
    
        for row in 0..




© 2015 - 2025 Weber Informatics LLC | Privacy Policy