当前位置: 首页 > news >正文

深圳app客户端做网站哪些软件可以做网页

深圳app客户端做网站,哪些软件可以做网页,江西建网站做优化,优秀seo平台200. 岛屿数量 200. 岛屿数量时间:O(mn);空间:O(min(m, n)),队列最大入队个数,可以想象从左上到右下,第一次入队1个,第二次出队1,入队2,第三次出队2,入队3……

200. 岛屿数量

  • 200. 岛屿数量
  • 时间:O(mn);空间:O(min(m, n)),队列最大入队个数,可以想象从左上到右下,第一次入队1个,第二次出队1,入队2,第三次出队2,入队3…
class Solution {
public:int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};  // 右,下,左,上int count = 0;int row;int column;void bfs(vector<vector<char>>& grid, int x, int y){queue<pair<int, int>>q;q.push({x, y});while(!q.empty()){auto t = q.front();q.pop();for(int i = 0; i < 4; i++){int new_x = t.first + dir[i][0], new_y = t.second + dir[i][1];if(new_x < 0 || new_x >= row || new_y < 0 || new_y >= column){continue;}if(grid[new_x][new_y] != '1'){continue;}grid[new_x][new_y] = '0';  // 访问q.push({new_x, new_y});}}}int numIslands(vector<vector<char>>& grid) {// bfsrow = grid.size(), column = grid[0].size();for(int i = 0; i < row; i++){for(int j = 0; j < column; j++){if(grid[i][j] == '1'){bfs(grid, i, j);++count;}}}return count;}
};

695. 岛屿的最大面积

  • 695. 岛屿的最大面积
  • 同上,bfs
class Solution {
public:int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};  // 右,下,左,上int ret = 0;int row;int column;int bfs(vector<vector<int>>& grid, int x, int y){grid[x][y] = 0;queue<pair<int, int>>q;q.push({x, y});int square = 1;while(!q.empty()){auto t = q.front();q.pop();for(int i = 0; i < 4; i++){int new_x = t.first + dir[i][0], new_y = t.second + dir[i][1];if(new_x < 0 || new_x >= row || new_y < 0 || new_y >= column){continue;}if(grid[new_x][new_y] != 1){continue;}grid[new_x][new_y] = 0;  // 访问++square;q.push({new_x, new_y});}}return square;}int maxAreaOfIsland(vector<vector<int>>& grid) {// bfsrow = grid.size(), column = grid[0].size();for(int i = 0; i < row; i++){for(int j = 0; j < column; j++){if(grid[i][j] == 1){int temp = bfs(grid, i, j);ret = max(ret, temp);}}}return ret;}
};

547. 省份数量

  • 547. 省份数量
  • 思路:修改bfs的访问
class Solution {
public:int count = 0;int row;int column;void bfs(vector<vector<int>>& grid, int x, int y){grid[x][y] = grid[y][x] = 0;queue<pair<int, int>>q;q.push({x, y});while(!q.empty()){auto t = q.front();q.pop();int new_x = t.first;for(int i = 0; i < column; i++){if(grid[new_x][i] == 0){continue;}grid[new_x][i] = grid[i][new_x] = 0;  // 访问q.push({i, new_x});}}}int findCircleNum(vector<vector<int>>& isConnected) {// bfsrow = isConnected.size(), column = isConnected[0].size();for(int i = 0; i < row; i++){for(int j = 0; j < column; j++){if(isConnected[i][j] == 1){bfs(isConnected, i, j);++count;}}}return count;}
};
http://www.yayakq.cn/news/51112/

相关文章:

  • 至少保存十个以上域名网站高校廉洁文化建设网站
  • 男人女人晚上做那事网站网站管理与维护方案
  • 安防网站建设优点长沙seo外包
  • 网站建设费用明细 xlswordpress woff
  • 济南网站建设方案咨询购物网站怎么创建
  • 连云港网站关键词邯郸教育平台网站建设
  • 网站信息发布制度建设电子商务软件
  • 怎样做网站推广网络网页制作
  • 国外网站备案自己做网站排名
  • 自己怎么做入网站回收书报wordpress要钱么
  • 手机网站需要备案吗哪个网站域名解析
  • 购物网站建设好处内蒙古建设 招聘信息网站
  • 免费信息发布网站有哪些安徽建设工程有限公司
  • 怎么做网站的浏览量wordpress resetpass
  • 做网站公司上班违法吗wordpress上下页翻页
  • 西安网站建设排行榜柳州 网站建设
  • 网站建设规划书主题东莞怎么建设网站公司
  • 地方门户网站策划书宁波seo排名方案
  • 冠县网站建设公司扫码员在哪个网站可以做
  • 唐山市住房房和城乡建设厅网站栾城网站建设
  • 为什么做电影网站没有流量吗宁波网络关键词优化费用
  • 设计公司网站 唐山windows做的ppt下载网站
  • 新手学网站建设内丘网站
  • 济南住房和城乡建设厅网站网站登录后不显示内容
  • h5做商城网站wordpress 视频 插件
  • 北京网站主题制作哪个网站可以做excel
  • 建设企业网站公司在哪里重庆seo排名收费
  • 苏州吴中区建设局工程网站柯桥网站建设
  • 成都响应网站建设帮人做网站收多少钱
  • 做室内设计人喜欢的网站免费源码大全无用下载