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

江门网站推广技巧服务整站优化深圳

江门网站推广技巧服务,整站优化深圳,网站建设有什么要求,web网站建设论文力扣题-12.2 [力扣刷题攻略] Re:从零开始的力扣刷题生活 力扣题1:423. 从英文中重建数字 解题思想:有的单词通过一个字母就可以确定,依次确定即可 class Solution(object):def originalDigits(self, s):""":typ…

力扣题-12.2

[力扣刷题攻略] Re:从零开始的力扣刷题生活

力扣题1:423. 从英文中重建数字

解题思想:有的单词通过一个字母就可以确定,依次确定即可

在这里插入图片描述

class Solution(object):def originalDigits(self, s):""":type s: str:rtype: str"""char_count = {}t = 'egfihonsrutwvxz'for i in range(len(t)):char_count[t[i]] = 0for i in range(len(s)):if s[i] in char_count:char_count[s[i]] += 1else:char_count[s[i]] = 1result = []if char_count['z']!=0:for i in range(char_count['z']):result.append(0)temp = 'zero'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['x']!=0:for i in range(char_count['x']):result.append(6)temp = 'six'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['w']!=0:for i in range(char_count['w']):result.append(2)temp = 'two'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['g']!=0:for i in range(char_count['g']):result.append(8)temp = 'eight'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['s']!=0:for i in range(char_count['s']):result.append(7)temp = 'seven'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['h']!=0:for i in range(char_count['h']):result.append(3)temp = 'three'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['v']!=0:for i in range(char_count['v']):result.append(5)temp = 'five'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['f']!=0:for i in range(char_count['f']):result.append(4)temp = 'four'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['o']!=0:for i in range(char_count['o']):result.append(1)temp = 'one'for i in range(len(temp)):char_count[temp[i]] -=1if char_count['i']!=0:for i in range(char_count['i']):result.append(9)temp = 'nine'for i in range(len(temp)):char_count[temp[i]] -=1return ''.join(map(str, sorted(result)))
class Solution {
public:std::string originalDigits(std::string s) {std::unordered_map<char, int> charCount;std::string t = "egfihonsrutwvxz";for (char c : t) {charCount[c] = 0;}for (char c : s) {if (charCount.find(c) != charCount.end()) {charCount[c] += 1;}}std::vector<int> result;if (charCount['z'] != 0) {int count = charCount['z'];for (int i = 0; i < count; ++i) {result.push_back(0);std::string temp = "zero";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['x'] != 0) {int count = charCount['x'];for (int i = 0; i < count; ++i) {result.push_back(6);std::string temp = "six";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['w'] != 0) {int count = charCount['w'];for (int i = 0; i < count; ++i) {result.push_back(2);std::string temp = "two";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['g'] != 0) {int count = charCount['g'];for (int i = 0; i < count; ++i) {result.push_back(8);std::string temp = "eight";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['s'] != 0) {int count = charCount['s'];for (int i = 0; i < count; ++i) {result.push_back(7);std::string temp = "seven";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['h'] != 0) {int count = charCount['h'];for (int i = 0; i < count; ++i) {result.push_back(3);std::string temp = "three";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['v'] != 0) {int count = charCount['v'];for (int i = 0; i < count; ++i) {result.push_back(5);std::string temp = "five";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['f'] != 0) {int count = charCount['f'];for (int i = 0; i < count; ++i) {result.push_back(4);std::string temp = "four";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['o'] != 0) {int count = charCount['o'];for (int i = 0; i < count; ++i) {result.push_back(1);std::string temp = "one";for (char c : temp) {charCount[c] -= 1;}}}if (charCount['i'] != 0) {int count = charCount['i'];for (int i = 0; i < count; ++i) {result.push_back(9);std::string temp = "nine";for (char c : temp) {charCount[c] -= 1;}}}std::sort(result.begin(), result.end());std::string resultString;for (int digit : result) {resultString += std::to_string(digit);}return resultString;}
};
http://www.jinmujx.cn/news/119182.html

相关文章:

  • 便宜的做网站网站建设服务商
  • 网站建设维护与推广好看的网站设计
  • 内蒙古地区做推广网站国家最新新闻
  • 胶州做网站企业查询软件
  • 简单的企业网站的主页徐州seo招聘
  • 公司网站进不去qq空间网络营销策划书案例
  • 建设银行宁波分行 招聘网站从事网络营销的公司
  • 网站开发用什么编程如何刷seo关键词排名
  • 怎么做辅助发卡网站服务推广软文范例
  • 上传的网站打不开如何做seo搜索优化
  • 百度做网站怎么样泉州百度首页优化
  • 居家网络架构重庆网站seo服务
  • 央企网站群建设网站买卖交易平台
  • 自如网站做的好 服务949公社招聘信息
  • 免费模型网站广告公司业务推广
  • java网站开发难吗青岛网站建设哪家好
  • 做排名的网站经典软文文案
  • 做网站的热门行业国外免费发产品的b2b平台
  • dw做网站教程seo网络贸易网站推广
  • 哪个网站亲子游做的好杭州排名优化公司
  • 河南郑州有疫情吗seo报告
  • 帮人做图挣外快的网站最新疫情最新消息
  • 微信的公众平台网站开发app投放渠道有哪些
  • 邯郸网站只做广西疫情最新消息
  • 网站制作怎样快速外贸网站seo教程
  • 做网站 视频青岛seo排名收费
  • 怎么做学校网站网站排行榜查询
  • 龙岩 网站建设百度app旧版本下载
  • 新兴建设网站网络卖货平台有哪些
  • 网站开发毕设销售营销方案100例