Kotlin O(n^2) solution
\nfun orderOfLargestPlusSign(n: Int, mines: Array<IntArray>): Int {\n        \n        // Setup initial state\n        // This matrix stores minimum vertical an
```\nfun orderOfLargestPlusSign(n: Int, mines: Array<IntArray>): Int {\n        \n        // Setup initial state\n        // This matrix stores minimum vertical and horizontal pathes to zero\n        val minPathes = Array<Array<IntArray>>(n) {\n            Array<IntArray>(n) { intArrayOf(Int.MAX_VALUE - 2, Int.MAX_VALUE - 2) }\n        }\n        \n        // Place zeroes to the matrix\n        for (mine in mines) {\n            minPathes[mine[0]][mine[1]][0] = 0\n            minPathes[mine[0]][mine[1]][1] = 0\n        }\n        \n        // Walk through the grid forward from left to right and from top to bottom.\n        // For each cell set minimum left path and minimum top path.\n        // So if we at cell (1, 2) we would look up at cell (0, 2) and left\n        // at cell (1, 1) to find out minimum top and left pathes to zero\n        for (i in 0 until n) {\n            for (j in 0 until n) {\n                // Find out top path to zero which is top path of the top cell + 1, \n                // or 1 if there is no top cell\n                val topPath = if (i > 0) minPathes[i - 1][j][0] + 1 else 1\n                \n                // Same for the left path\n                val leftPath = if(j > 0) minPathes[i][j - 1][1] + 1 else 1\n                \n                // Now set minimum top and left pathes for current cell\n                minPathes[i][j][0] = minOf(minPathes[i][j][0], topPath)\n                minPathes[i][j][1] = minOf(minPathes[i][j][1], leftPath)\n            }\n        }\n        \n        var maxPath = 0\n        \n        // Now walk back through grid from right to left and from bottom to top.\n        // Here we will find minimum right and bottom pathes to zeroes for each cell.\n        // And as we already know left and top pathes, we can actually calculate maximum\n        // vertical and horizontal pathes to zero and find out maximal plus sign order for\n        // current cell. We track maximum plus sign order walking through the grid \n        // and return this value after all\n        for (i in n - 1 downTo 0) {\n            for (j in n - 1 downTo 0) {\n                val bottomPath = if (i < n - 1) minPathes[i + 1][j][0] + 1 else 1\n                val rightPath = if (j < n - 1) minPathes[i][j + 1][1] + 1 else 1\n                \n                minPathes[i][j][0] = minOf(minPathes[i][j][0], bottomPath)\n                minPathes[i][j][1] = minOf(minPathes[i][j][1], rightPath)\n                maxPath = maxOf(minPathes[i][j].min() ?: 0, maxPath)\n            }\n        }\n\n        return maxPath\n    }\n```
[]