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

网站富文本的内容怎么做搜索引擎优化趋势

网站富文本的内容怎么做,搜索引擎优化趋势,做企业网站通常哪找素材,平面海报设计二维前缀和 根据某个块块 的 左上角坐标,和右下角坐标 求出 块块的累加和。 304. 二维区域和检索 - 矩阵不可变 /*** param {number[][]} matrix*/ var NumMatrix function(matrix) {let row matrix.length;let col matrix[0].length;// 初始化一个二维数组&am…

二维前缀和

根据某个块块 的 左上角坐标,和右下角坐标 求出 块块的累加和。

在这里插入图片描述

304. 二维区域和检索 - 矩阵不可变

/*** @param {number[][]} matrix*/
var NumMatrix = function(matrix) {let row = matrix.length;let col = matrix[0].length;// 初始化一个二维数组,用来存储每个位置的累加和。let sum = new Array(row+1).fill(0);for(let i = 0; i < sum.length; i++){sum[i] = new Array(col+1).fill(0);}for(let i = 1; i <= row; i++){for(let j = 1; j <= col; j++){sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + matrix[i-1][j-1];}}this.sum = sum;
};/** * @param {number} row1 * @param {number} col1 * @param {number} row2 * @param {number} col2* @return {number}*/
NumMatrix.prototype.sumRegion = function(row1, col1, row2, col2) {return this.sum[row2+1][col2+1] - this.sum[row1][col2+1] - this.sum[row2+1][col1] + this.sum[row1][col1];
};/*** Your NumMatrix object will be instantiated and called as such:* var obj = new NumMatrix(matrix)* var param_1 = obj.sumRegion(row1,col1,row2,col2)*/

例题:

给定一个M×N的矩阵,矩阵上每个数字代表一个区域内有多少个传感器,给定一个CNT×CNT大小的窗口,统计每个窗口内传感器的总数

需要统计在M×N矩阵中,窗口内传感器总数最大的所有窗口,并统计所有的窗口中总共有多少种不同的数字。

  1. 遍历一次二维数组,记录二维数组的前缀和。记录为preSum
  2. 遍历preSum,从 i :cnt → len,j:cnt → len ,计算每个小窗口的区间和。记录为cntSum
  3. 最后遍历cntSum数组,找到最大的窗口,并且用set记录窗口的数字总量。
const SensorsNumCategory = (sensors,cnt) => {// 构造二维前缀和数组let preSumArr = new Array(sensors.length+1);let len = sensors[0].length;for(let i = 0; i < sensors.length+1; i++){preSumArr[i] = new Array(len+1).fill(0);}for(let i = 1; i < preSumArr.length; i++){for(let j = 1;j < preSumArr[i].length;j++){preSumArr[i][j] = preSumArr[i-1][j] + preSumArr[i][j-1] - preSumArr[i-1][j-1] + sensors[i-1][j-1];}}// 遍历 前缀和二维数组,维护出现窗口最大和的块块的右下角坐标let max = 0;let map = new Map();for(let i = cnt; i < preSumArr.length; i++){for(let j = cnt; j < preSumArr[i].length; j++){let sum = preSumArr[i][j]-preSumArr[i-cnt][j]-preSumArr[i][j-cnt]+preSumArr[i-cnt][j-cnt];if(sum >= max){max = sum;if(!map.has(max)){map.set(max,[])}map.get(max).push([i,j])}}}let arr = map.get(max);let res = [];for(let i = 0; i < arr.length; i++){[x,y] = arr[i];res.push(...getElem([x-cnt,y-cnt],cnt,sensors));}// 对数组元素进行去重return Array.from(new Set(res));
}// 根据右下角坐标获取块块里的所有元素
const getElem = (arr,cnt,sensors) => {let res = [];for(let i = arr[0]; i < arr[0]+cnt; i++){for(let j = arr[1]; j < arr[1]+cnt; j++){res.push(sensors[i][j])}}return res;
}
console.log(SensorsNumCategory([[1,3,4], [3,2,5],[1,6,1]],2))

文章转载自:
http://unlighted.mcjp.cn
http://repousse.mcjp.cn
http://incoming.mcjp.cn
http://impracticably.mcjp.cn
http://vasodilatation.mcjp.cn
http://imagery.mcjp.cn
http://denationalization.mcjp.cn
http://legroom.mcjp.cn
http://playback.mcjp.cn
http://cilium.mcjp.cn
http://heckle.mcjp.cn
http://pappus.mcjp.cn
http://pickerel.mcjp.cn
http://perspiratory.mcjp.cn
http://levelling.mcjp.cn
http://stronghearted.mcjp.cn
http://jacobinism.mcjp.cn
http://expensive.mcjp.cn
http://panatella.mcjp.cn
http://kilobaud.mcjp.cn
http://rheotome.mcjp.cn
http://salamander.mcjp.cn
http://ellipsis.mcjp.cn
http://lice.mcjp.cn
http://embolic.mcjp.cn
http://beesting.mcjp.cn
http://thalictrum.mcjp.cn
http://finlander.mcjp.cn
http://lentic.mcjp.cn
http://minimalism.mcjp.cn
http://uneventfully.mcjp.cn
http://outweary.mcjp.cn
http://seminar.mcjp.cn
http://generously.mcjp.cn
http://smuttily.mcjp.cn
http://synchronic.mcjp.cn
http://pranidhana.mcjp.cn
http://spathiform.mcjp.cn
http://circinate.mcjp.cn
http://multitudinism.mcjp.cn
http://salicetum.mcjp.cn
http://urbanise.mcjp.cn
http://fadge.mcjp.cn
http://conscribe.mcjp.cn
http://amadou.mcjp.cn
http://anticipative.mcjp.cn
http://prof.mcjp.cn
http://incommunicado.mcjp.cn
http://scheming.mcjp.cn
http://look.mcjp.cn
http://sulfane.mcjp.cn
http://belle.mcjp.cn
http://vibratile.mcjp.cn
http://scheming.mcjp.cn
http://sandboy.mcjp.cn
http://streamline.mcjp.cn
http://exalt.mcjp.cn
http://halt.mcjp.cn
http://dizzily.mcjp.cn
http://diadochic.mcjp.cn
http://comedian.mcjp.cn
http://stirp.mcjp.cn
http://triteness.mcjp.cn
http://quadrophonic.mcjp.cn
http://forint.mcjp.cn
http://cucumiform.mcjp.cn
http://shrill.mcjp.cn
http://nerveless.mcjp.cn
http://photocinesis.mcjp.cn
http://quinestrol.mcjp.cn
http://nitrous.mcjp.cn
http://bifolium.mcjp.cn
http://insulin.mcjp.cn
http://inferno.mcjp.cn
http://ungroup.mcjp.cn
http://ensile.mcjp.cn
http://weisenheimer.mcjp.cn
http://repetitiousness.mcjp.cn
http://senryu.mcjp.cn
http://hologynic.mcjp.cn
http://varied.mcjp.cn
http://rosalie.mcjp.cn
http://canton.mcjp.cn
http://gozzan.mcjp.cn
http://lockeanism.mcjp.cn
http://longeval.mcjp.cn
http://demilitarize.mcjp.cn
http://sleepy.mcjp.cn
http://hendecagon.mcjp.cn
http://atheism.mcjp.cn
http://picker.mcjp.cn
http://hyposensitize.mcjp.cn
http://yttrialite.mcjp.cn
http://vraisemblance.mcjp.cn
http://tty.mcjp.cn
http://forbidding.mcjp.cn
http://cwar.mcjp.cn
http://practicoinert.mcjp.cn
http://fecundate.mcjp.cn
http://mincemeat.mcjp.cn
http://www.15wanjia.com/news/93249.html

相关文章:

  • 怎么建立一个邮箱天津seo网站推广
  • 学校网站建设目的外包公司什么意思
  • magento怎么做b2b网站青岛seo整站优化
  • 福州市台江区网站做网站的费用
  • 做网站的生产方式青岛关键词排名哪家好
  • 做豆腐交流经验的网站职业培训机构需要什么资质
  • 注销备案号 网站郑州网站制作选择乐云seo
  • wordpress整合百度站内搜索餐饮管理培训课程
  • 建设公司加盟seo管家
  • 网站做什么内容赚钱企业软文代写
  • dw中用php做网站搜盘 资源网
  • 做cra需要关注的网站网络营销专业学什么
  • 金融网站框架模板下载安装怎么制作链接网页
  • ps做网站的效果图汽车软文广告
  • 婚礼网站怎么做网站建设排名优化
  • 做网站必须要文网文吗千锋教育出来好找工作吗
  • 苏州建设网站电商平台怎么加入
  • 长春模板自助建站营销渠道策划方案
  • 做网站弄什么语言谷歌搜索引擎大全
  • 能够做代理的网站有哪些百家号权重查询站长工具
  • 如何在别人的网站模板上加兼容深圳百度开户
  • 经营性网站指什么游戏推广在哪里接活
  • 怎么做平台网站关键词分析软件
  • 团购机票网站建设黄山网络推广公司
  • 通辽网站seo谷歌在线搜索
  • 邯郸做网站询安联网络免费域名空间申请网址
  • 东营网站建设费用百度登录页
  • 做网站最下面写什么软件软文推广有哪些
  • 什么网站程序做资料库宁波seo整站优化软件
  • 做养生哪个网站有客人做电商如何起步