Ruby 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\ndef largest1_bordered_square(grid)\n  rows, cols = grid.size, grid[0].size\n  max_side = 0\n  dp = Array.new(rows) { Array.new(cols) { [0, 0] } }\n\n  (0...rows).each do |r|\n    (0...cols).each do |c|\n      next if grid[r][c].zero?\n      dp[r][c] = [c > 0 ? dp[r][c - 1][0] + 1 : 1, r > 0 ? dp[r - 1][c][1] + 1 : 1]\n      side = [dp[r][c][0], dp[r][c][1]].min\n\n      while side > max_side\n        max_side = side if dp[r - side + 1][c][0] >= side && dp[r][c - side + 1][1] >= side\n        side -= 1\n      end\n    end\n  end\n\n  max_side * max_side\nend\n\ngrid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]\nputs largest1_bordered_square(grid)\n\n```
['Ruby']