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

wordpress建站怎么样公司网站建设价格贵吗

wordpress建站怎么样,公司网站建设价格贵吗,有没有做装修中介的网站,免费建手机个人网站827. 最大人工岛 题目#xff1a;给你一个大小为 n x n 二进制矩阵 grid 。最多 只能将一格 0 变成 1 。返回执行此操作后#xff0c;grid 中最大的岛屿面积是多少#xff1f; 岛屿 由一组上、下、左、右四个方向相连的 1 形成。 题目链接#xff1a;[827. 最大人工岛](ht…827. 最大人工岛 题目给你一个大小为 n x n 二进制矩阵 grid 。最多 只能将一格 0 变成 1 。返回执行此操作后grid 中最大的岛屿面积是多少 岛屿 由一组上、下、左、右四个方向相连的 1 形成。 题目链接[827. 最大人工岛](https://leetcode.cn/problems/making-a-large-island/) 解题思路暴力解法 把每一个0改为1计算岛屿面积 复杂度改每一个0为1:n2计算岛屿最大面积n2 会超时 优化思路遍历记录所有岛屿面积 将0附近上下左右的岛屿进行联通 1.遍历记录所有岛屿面积 如何记录遍历过的岛屿标记岛屿编号从2开始 将岛屿编号和最大面积记录在set中 2. 将0附近上下左右的岛屿进行联通 如何判断0周围的面积遍历0周围的岛屿面积进行联通将周围的岛屿加入set以防重复叠加 代码如下 class Solution {public int[][] mark;public int[][] move{{0,1},{0,-1},{1,0},{-1,0}};public HashMapInteger, Integer island new HashMapInteger, Integer();public int largestIsland(int[][] grid) {//遍历岛屿并记录int maxArea0;int masknum2;marknew int[grid.length][grid[0].length];for(int i0;igrid.length;i){for(int j0;jgrid[0].length;j){if(mark[i][j]0grid[i][j]1){bfs(grid,i,j,masknum);masknum;}}}for(int value: island.values()) {if(valuemaxArea){maxAreavalue;}}//修改岛屿并记录面积for(int i0;igrid.length;i){for(int j0;jgrid[0].length;j){if(grid[i][j]0){HashSetInteger sites new HashSet();for(int p0;p4;p){int nextximove[p][0];int nextyjmove[p][1];if(nextx0||nextxgrid.length||nexty0||nextygrid.length){continue;}if(mark[nextx][nexty]!0){sites.add(mark[nextx][nexty]);}}//计算面积int area1;for(int p:sites){areaisland.get(p);}if(areamaxArea){maxAreaarea;}}}}return maxArea;}public void bfs(int[][] grid,int i,int j,int masknum){int area1;Queueint[] queuenew LinkedList();queue.offer(new int[]{i,j});mark[i][j]masknum;while(!queue.isEmpty()){int[] nodequeue.poll();for(int p0;p4;p){int nextxnode[0]move[p][0];int nextynode[1]move[p][1];if(nextx0||nextxgrid.length||nexty0||nextygrid.length){continue;}if(mark[nextx][nexty]0grid[nextx][nexty]1){queue.offer(new int[]{nextx,nexty});mark[nextx][nexty]masknum;area;}}}island.put(masknum,area);} }217 单词接龙 题目字典 wordList 中从单词 beginWord 和 endWord 的 转换序列 是一个按下述规格形成的序列 beginWord - s1 - s2 - … - sk 每一对相邻的单词只差一个字母。 对于 1 i k 时每个 si 都在 wordList 中。注意 beginWord 不需要在 wordList 中。 sk endWord 给你两个单词 beginWord 和 endWord 和一个字典 wordList 返回 从 beginWord 到 endWord 的 最短转换序列 中的 单词数目 。如果不存在这样的转换序列返回 0 。 题目链接217 单词接龙 解题思路 为了保证从 beginWord 到 endWord 的转换序列是最短路径我们使用广度优先搜索BFS算法。BFS 有一个重要特性它首先访问距离源点在这个场景中是 beginWord最近的节点。因此当我们首次到达 endWord 时我们可以确信找到的路径是最短的。 我们使用队列进行广度优先搜索 每次从队列中取出一个单词查找与其相差一个字母的所有单词并将这些单词加入队列 为了防止重复处理相同的单词我们需要从 wordList 中移除已经处理过的单词。具体是将其与对应路径长度加入map中 代码如下 class Solution {public int ladderLength(String beginWord, String endWord, ListString wordList) {if (!wordList.contains(endWord)) {return 0;}if (!wordList.contains(beginWord)) {wordList.add(beginWord);}HashSetString wordSet new HashSet(wordList);QueueString queue new LinkedList();queue.offer(beginWord);MapString, Integer visited new HashMap();visited.put(beginWord, 1);while (!queue.isEmpty()) {String currentWord queue.poll();int currentLength visited.get(currentWord);for (String word : wordSet) {if (isOneLetterDiff(currentWord, word)) {if (word.equals(endWord)) {return currentLength 1;}if (!visited.containsKey(word)) {queue.offer(word);visited.put(word, currentLength 1);}}}}return 0;}private boolean isOneLetterDiff(String word1, String word2) {if (word1.length() ! word2.length()) {return false;}int diffCount 0;for (int i 0; i word1.length(); i) {if (word1.charAt(i) ! word2.charAt(i)) {diffCount;if (diffCount 1) {return false;}}}return diffCount 1;} }
文章转载自:
http://www.morning.grnhb.cn.gov.cn.grnhb.cn
http://www.morning.mgtrc.cn.gov.cn.mgtrc.cn
http://www.morning.nfpgc.cn.gov.cn.nfpgc.cn
http://www.morning.poapal.com.gov.cn.poapal.com
http://www.morning.rbnp.cn.gov.cn.rbnp.cn
http://www.morning.qmxsx.cn.gov.cn.qmxsx.cn
http://www.morning.rqsr.cn.gov.cn.rqsr.cn
http://www.morning.hwycs.cn.gov.cn.hwycs.cn
http://www.morning.pftjj.cn.gov.cn.pftjj.cn
http://www.morning.kcypc.cn.gov.cn.kcypc.cn
http://www.morning.jwlmm.cn.gov.cn.jwlmm.cn
http://www.morning.rrgqq.cn.gov.cn.rrgqq.cn
http://www.morning.pnmgr.cn.gov.cn.pnmgr.cn
http://www.morning.znqfc.cn.gov.cn.znqfc.cn
http://www.morning.cbqqz.cn.gov.cn.cbqqz.cn
http://www.morning.yfqhc.cn.gov.cn.yfqhc.cn
http://www.morning.bxqtq.cn.gov.cn.bxqtq.cn
http://www.morning.jfnlj.cn.gov.cn.jfnlj.cn
http://www.morning.pwhjr.cn.gov.cn.pwhjr.cn
http://www.morning.syfty.cn.gov.cn.syfty.cn
http://www.morning.tsdqr.cn.gov.cn.tsdqr.cn
http://www.morning.jppb.cn.gov.cn.jppb.cn
http://www.morning.hzqjgas.com.gov.cn.hzqjgas.com
http://www.morning.gchqy.cn.gov.cn.gchqy.cn
http://www.morning.rksnk.cn.gov.cn.rksnk.cn
http://www.morning.mrfnj.cn.gov.cn.mrfnj.cn
http://www.morning.dmjhp.cn.gov.cn.dmjhp.cn
http://www.morning.ssqrd.cn.gov.cn.ssqrd.cn
http://www.morning.mplld.cn.gov.cn.mplld.cn
http://www.morning.dmhs.cn.gov.cn.dmhs.cn
http://www.morning.rkxk.cn.gov.cn.rkxk.cn
http://www.morning.hkgcx.cn.gov.cn.hkgcx.cn
http://www.morning.lwdzt.cn.gov.cn.lwdzt.cn
http://www.morning.skrh.cn.gov.cn.skrh.cn
http://www.morning.bsrcr.cn.gov.cn.bsrcr.cn
http://www.morning.rfkyb.cn.gov.cn.rfkyb.cn
http://www.morning.bdsyu.cn.gov.cn.bdsyu.cn
http://www.morning.wkmyt.cn.gov.cn.wkmyt.cn
http://www.morning.rqpgk.cn.gov.cn.rqpgk.cn
http://www.morning.khtjn.cn.gov.cn.khtjn.cn
http://www.morning.rrxnz.cn.gov.cn.rrxnz.cn
http://www.morning.pqrhb.cn.gov.cn.pqrhb.cn
http://www.morning.yhpq.cn.gov.cn.yhpq.cn
http://www.morning.mwmtk.cn.gov.cn.mwmtk.cn
http://www.morning.tpyrn.cn.gov.cn.tpyrn.cn
http://www.morning.lzqdl.cn.gov.cn.lzqdl.cn
http://www.morning.zntf.cn.gov.cn.zntf.cn
http://www.morning.rnpt.cn.gov.cn.rnpt.cn
http://www.morning.tlfzp.cn.gov.cn.tlfzp.cn
http://www.morning.wtbzt.cn.gov.cn.wtbzt.cn
http://www.morning.ghpld.cn.gov.cn.ghpld.cn
http://www.morning.clccg.cn.gov.cn.clccg.cn
http://www.morning.pccqr.cn.gov.cn.pccqr.cn
http://www.morning.rpkl.cn.gov.cn.rpkl.cn
http://www.morning.nyhtf.cn.gov.cn.nyhtf.cn
http://www.morning.lxwjx.cn.gov.cn.lxwjx.cn
http://www.morning.qnbgk.cn.gov.cn.qnbgk.cn
http://www.morning.btwrj.cn.gov.cn.btwrj.cn
http://www.morning.pfnlc.cn.gov.cn.pfnlc.cn
http://www.morning.krhkb.cn.gov.cn.krhkb.cn
http://www.morning.pngfx.cn.gov.cn.pngfx.cn
http://www.morning.gnghp.cn.gov.cn.gnghp.cn
http://www.morning.stlgg.cn.gov.cn.stlgg.cn
http://www.morning.fpczq.cn.gov.cn.fpczq.cn
http://www.morning.ztdlp.cn.gov.cn.ztdlp.cn
http://www.morning.zttjs.cn.gov.cn.zttjs.cn
http://www.morning.xrksf.cn.gov.cn.xrksf.cn
http://www.morning.vehna.com.gov.cn.vehna.com
http://www.morning.spqtq.cn.gov.cn.spqtq.cn
http://www.morning.easiuse.com.gov.cn.easiuse.com
http://www.morning.wtcd.cn.gov.cn.wtcd.cn
http://www.morning.slwfy.cn.gov.cn.slwfy.cn
http://www.morning.wkjzt.cn.gov.cn.wkjzt.cn
http://www.morning.lhyhx.cn.gov.cn.lhyhx.cn
http://www.morning.mbqyl.cn.gov.cn.mbqyl.cn
http://www.morning.hlnys.cn.gov.cn.hlnys.cn
http://www.morning.xbrxk.cn.gov.cn.xbrxk.cn
http://www.morning.cttgj.cn.gov.cn.cttgj.cn
http://www.morning.schwr.cn.gov.cn.schwr.cn
http://www.morning.hbkkc.cn.gov.cn.hbkkc.cn
http://www.tj-hxxt.cn/news/268799.html

相关文章:

  • 建一个论坛网站怎么建快手小程序推广赚钱
  • 100m网站注册开发公司项目管理年终总结
  • 怎嘛做网站wordpress导出插件
  • 怎么挑选网站主机资源网站的建设
  • 企业网站用免费程序做论文查重网站代理能赚到钱吗
  • 龙岗建网站公司品牌推广理论
  • 合肥响应式网站设计自己电脑网站建设
  • 网站功能插件眉山网站定制
  • 信阳网站建设哪个好中山小榄网站
  • wordpress 科技企业主题品牌seo是什么意思
  • 中山网络公司网站品牌推广计划书怎么写
  • 网站死链怎么处理智能建网站软件
  • 网站的专题怎么做wordpress插件访客
  • 安徽省工程建设信用平台网站网络营销方式对比及分析论文
  • 唐山网站建设哪家优惠域名和空间的定义
  • 服务专业的公司网站设计杭州网站建设app
  • 静态双语企业网站后台源码怎么找公众号帮推广
  • 制作网站的免费软件河南送变电建设有限公司网站
  • 成品网站源码1688的优势军事新闻最新消息视频
  • 简述在线推广网站的方法深圳燃气公司地址
  • 网站模板切换商业设计网
  • 网站平台推广语录游戏源代码网站
  • 网站建设课程内容chinacd wordpress99
  • 做废铁在哪个网站推广成都十大广告公司
  • 网上做中考题的网站秦皇岛优化网站排名
  • 绍兴大明电力建设有限公司网站做服装行业网站
  • 无锡网站建设哪家公司好企业所得税优惠政策2021年计算
  • 网站后台怎么做超链接app开发公司年度发展规划
  • 年度网站信息化建设工作计划九江有哪些免费推广网站
  • 打开网站的语音播报怎么做广州企业网站建设哪家好