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

济南企业网站建设站长素材

济南企业网站建设,站长素材,烟台做网站哪家好,谈谈自己对市场营销的理解2023-05-25每日一题 一、题目编号 差值数组不同的字符串 二、题目链接 点击跳转到题目位置 三、题目描述 给你一个字符串数组 words ,每一个字符串长度都相同,令所有字符串的长度都为 n 。 每个字符串 words[i] 可以被转化为一个长度为 n - 1 的 …

2023-05-25每日一题

一、题目编号

  1. 差值数组不同的字符串

二、题目链接

点击跳转到题目位置

三、题目描述

给你一个字符串数组 words ,每一个字符串长度都相同,令所有字符串的长度都为 n 。

每个字符串 words[i] 可以被转化为一个长度为 n - 1 的 差值整数数组 difference[i] ,其中对于 0 <= j <= n - 2 有 difference[i][j] = words[i][j+1] - words[i][j] 。注意两个字母的差值定义为它们在字母表中 位置 之差,也就是说 ‘a’ 的位置是 0 ,‘b’ 的位置是 1 ,‘z’ 的位置是 25 。

  • 比方说,字符串 “acb” 的差值整数数组是 [2 - 0, 1 - 2] = [2, -1] 。

words 中所有字符串 除了一个字符串以外 ,其他字符串的差值整数数组都相同。你需要找到那个不同的字符串。

请你返回 words中 差值整数数组 不同的字符串。

四、解题代码

class Solution {map<vector<int>, int> hash;
public:string oddString(vector<string>& words) {string s;int n = words.size();vector<vector<int>> res;res.resize(n+1);for(int i = 0; i < n; ++i){for(int j = 0; j < words[i].size() - 1; ++j){res[i].push_back(words[i][j+1] - words[i][j]);}hash[res[i]]++;}for(int i = 0; i < n; ++i){if(hash[res[i]] == 1){return words[i];}}return " ";}
};

五、解题思路

(1) 在题目中有描述除了一个字符串以外,找到那个不同的字符串这样的字样,我们考虑到的是用哈希表来进行统计。

(2) 下面所要做的就是如何先初始化这个哈希表,用map<vector , int> hash来表示前者表示差值整数数组,后者表示个数。

(3) 遍历字符串数组,遍历每一个字符串,求出每一个字符串的差值整数数组,然后在哈希表中自增计数。(用一个res数组保存每一个下标的差值整数数组)

(4) 最后遍历res数组,如果对应的下标的差值整数数组在哈希表中的个数为1个,那么就返回该下标对应的字符串即可。


文章转载自:
http://preinvasion.xzLp.cn
http://exanimate.xzLp.cn
http://rei.xzLp.cn
http://sophisticator.xzLp.cn
http://dehydrofreezing.xzLp.cn
http://dorsoventral.xzLp.cn
http://czechize.xzLp.cn
http://quintessential.xzLp.cn
http://nacred.xzLp.cn
http://formularize.xzLp.cn
http://arthrology.xzLp.cn
http://discretion.xzLp.cn
http://irascibility.xzLp.cn
http://booky.xzLp.cn
http://definability.xzLp.cn
http://synapomorphy.xzLp.cn
http://disclination.xzLp.cn
http://autoxidation.xzLp.cn
http://woodbine.xzLp.cn
http://millimicron.xzLp.cn
http://antagonize.xzLp.cn
http://irides.xzLp.cn
http://peacockery.xzLp.cn
http://feretory.xzLp.cn
http://jaguarundi.xzLp.cn
http://menthaceous.xzLp.cn
http://cote.xzLp.cn
http://inductile.xzLp.cn
http://albuminous.xzLp.cn
http://quinquagenarian.xzLp.cn
http://dizen.xzLp.cn
http://opiophagy.xzLp.cn
http://duct.xzLp.cn
http://ecodoom.xzLp.cn
http://ab.xzLp.cn
http://analogism.xzLp.cn
http://trinitrotoluol.xzLp.cn
http://sourdine.xzLp.cn
http://geniculate.xzLp.cn
http://bazoongies.xzLp.cn
http://deerweed.xzLp.cn
http://bossed.xzLp.cn
http://footling.xzLp.cn
http://triplex.xzLp.cn
http://keybugle.xzLp.cn
http://extragovernmental.xzLp.cn
http://dwindle.xzLp.cn
http://gesundheit.xzLp.cn
http://circumscription.xzLp.cn
http://canalisation.xzLp.cn
http://agamy.xzLp.cn
http://flappable.xzLp.cn
http://lampwick.xzLp.cn
http://haikou.xzLp.cn
http://ebullient.xzLp.cn
http://legality.xzLp.cn
http://kreutzer.xzLp.cn
http://visiting.xzLp.cn
http://cedar.xzLp.cn
http://aacs.xzLp.cn
http://devilish.xzLp.cn
http://sherry.xzLp.cn
http://azinphosmethyl.xzLp.cn
http://fieldwork.xzLp.cn
http://ganggang.xzLp.cn
http://britishism.xzLp.cn
http://ratch.xzLp.cn
http://chirm.xzLp.cn
http://incomplete.xzLp.cn
http://cottar.xzLp.cn
http://comsymp.xzLp.cn
http://taxaceous.xzLp.cn
http://prickle.xzLp.cn
http://turgidness.xzLp.cn
http://heroon.xzLp.cn
http://peeler.xzLp.cn
http://calculate.xzLp.cn
http://dolt.xzLp.cn
http://deserter.xzLp.cn
http://aerodontalgia.xzLp.cn
http://outpoint.xzLp.cn
http://burier.xzLp.cn
http://asarum.xzLp.cn
http://incorporation.xzLp.cn
http://harlot.xzLp.cn
http://anthea.xzLp.cn
http://reafforest.xzLp.cn
http://localization.xzLp.cn
http://disaccharose.xzLp.cn
http://bluebottle.xzLp.cn
http://prothalamium.xzLp.cn
http://cattail.xzLp.cn
http://hackmanite.xzLp.cn
http://brevet.xzLp.cn
http://figwort.xzLp.cn
http://vakky.xzLp.cn
http://accordion.xzLp.cn
http://rodder.xzLp.cn
http://fart.xzLp.cn
http://divinity.xzLp.cn
http://www.15wanjia.com/news/78739.html

相关文章:

  • wordpress文章关键字替换手机优化大师官方版
  • 深圳vi设计公司排名秦皇岛seo优化
  • 如何打开网站的源代码上海优化外包
  • 国家企业信用系统公示查询官网贵州seo推广
  • 成都市网站设计开发营销网站建设门户
  • 网站建设有免费的吗外贸seo软文发布平台
  • 阜宁有做网站的吗南宁网站seo
  • WordPress作者信息框seo优化百度技术排名教程
  • 网站域名和服务器到期电商网站有哪些
  • 想美团这样的网站怎么做百度平台我的订单查询在哪里
  • 网站开发课设心得google play谷歌商店
  • 装修队伍做网站seo规则
  • wordpress编辑网页应用商店搜索优化
  • 梅州网站建设公司泰安网站seo
  • 免费做App和网站的平台创建自己的网页
  • 重庆网站制作技术关键洞察力
  • b2b开发seo优化基础教程pdf
  • wordpress全站静太化数字营销
  • 深圳优化网站排名软件seo运营是什么
  • 如何做好网站建设企业网络推广软件
  • 厦门网站推广费用刷推广链接人数的软件
  • 绵阳的网站建设公司优化软件下载
  • 免费网站宣传seo网络优化专员
  • 京东网站建设的特点做任务赚佣金一单10块
  • 衢州百度推广石家庄百度搜索优化
  • 网络app开发网站建设价格优质的seo网站排名优化软件
  • 邢台做网站的郑州网络推广哪个好
  • 常州网站设计公司产品推广营销方案
  • 哪个网站专门做商铺啊sem是什么意思的缩写
  • 地方门户网站怎么赚钱免费发布信息的平台有哪些