当前位置:   article > 正文

华为OD最新面试手撕代码:被围绕的区域_华为od 手撕代码

华为od 手撕代码

题目

被围绕的区域

给你一个 m x n 的矩阵 board ,由若干字符 'X' 和 'O' ,找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。

示例 1
  1. 输入:board=[
  2. ["X”,"X","X","0","X","X","X","X"],
  3. ["X","0","0","X","0","X","0","0"]
  4. ["X","0","X","X","0","0","0","X"]
  5. ["X","X","X","0","X","X","X","X"J,
  6. ["0","0”,"0”,"X","X","X","X","X"]
  7. ["X","0“,"X","X","X","X","X","X"]
  8. 输出:[
  9. ["X","X","X","0","X","X"
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/918983
推荐阅读
相关标签
  

闽ICP备14008679号