[Go] Compare halves of squares
\nfunc min(x, y int) int {\n    if x < y {\n        return x\n    }\n    return y\n}\n\nfunc max(x, y int) int {\n    if x > y {\n        return x\n    }\n    r
```\nfunc min(x, y int) int {\n    if x < y {\n        return x\n    }\n    return y\n}\n\nfunc max(x, y int) int {\n    if x > y {\n        return x\n    }\n    return y\n}\n\nfunc largest1BorderedSquare(grid [][]int) int {\n    ans := 0\n    m := len(grid)\n    n := len(grid[0])\n    side := make([][]int, m)\n    for i := 0; i < m; i++ {\n        side[i] = make([]int, n)\n        for j := 0; j < n; j++ {\n            if grid[i][j] != 1 {\n                continue\n            }\n            down := 0\n            for k := i; k < m; k++ {\n                if grid[k][j] == 1 {\n                    down += 1\n                } else {\n                    break\n                }\n            }\n            right := 0\n            for k := j; k < n; k++ {\n                if grid[i][k] == 1 {\n                    right += 1\n                } else {\n                    break\n                }\n            }\n            side[i][j] = min(down, right)\n            for k := 0; k <= min(i, j); k++ {\n                if grid[i-k][j] == 1 && grid[i][j-k] == 1 {\n                    if side[i-k][j-k] >= k {\n                        ans = max(ans, (k+1)*(k+1))\n                    }\n                } else {\n                    break\n                }\n            }\n        }\n    }\n    return ans\n}\n```
['Dynamic Programming', 'Go']