✔️ 100% Fastest Swift Solution
\nclass Solution {\n\tfunc maximalRectangle(_ matrix: [[Character]]) -> Int {\n        if matrix.count == 0 || matrix[0].count == 0 { return 0 }\n        var ma
```\nclass Solution {\n\tfunc maximalRectangle(_ matrix: [[Character]]) -> Int {\n        if matrix.count == 0 || matrix[0].count == 0 { return 0 }\n        var max = 0\n\n        for i in 0..<matrix.count {\n            for j in 0..<matrix[0].count {\n                let area = helper(matrix, i, j, matrix.count,  matrix[0].count)\n                max = max > area ? max : area\n            }\n        }\n        \n        return max\n    }\n\n\n    func helper(_ matrix: [[Character]], _ i: Int, _ j: Int, _ maxI: Int, _ maxJ: Int) -> Int {\n        if matrix[i][j] == "0" || maxI == i || maxJ == j { return 0 }\n        var x = -1\n        var y = -1\n\n        loop: \n        for row in i..<maxI {\n            for col in j..<maxJ {\n                if matrix[row][col] == "0" {\n                    x = row\n                    y = col\n                    break loop\n                }\n            }\n        }\n        \n        if x >= 0 {\n            return max(helper(matrix, i, j, x, maxJ), helper(matrix, i, j, maxI, y))\n        } else {\n            return (maxI - i) * (maxJ - j)\n        } \n    }\n    \n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['Swift']