public class Solution {
public string OriginalDigits(string s) {
int[] count = new int[];
for (int i = ; i < s.Length; i++)
{
char c = s[i];
if (c == 'z') count[]++;
if (c == 'w') count[]++;
if (c == 'x') count[]++;
if (c == 's') count[]++; //7-6
if (c == 'g') count[]++;
if (c == 'u') count[]++;
if (c == 'f') count[]++; //5-4
if (c == 'h') count[]++; //3-8
if (c == 'i') count[]++; //9-8-5-6
if (c == 'o') count[]++; //1-0-2-4
}
count[] -= count[];
count[] -= count[];
count[] -= count[];
count[] = count[] - count[] - count[] - count[];
count[] = count[] - count[] - count[] - count[];
StringBuilder sb = new StringBuilder();
for (int i = ; i <= ; i++)
{
for (int j = ; j < count[i]; j++)
{
sb.Append(i);
}
}
return sb.ToString();
}
}

https://leetcode.com/problems/reconstruct-original-digits-from-english/#/description

leetcode423的更多相关文章

  1. [Swift]LeetCode423. 从英文中重建数字 | Reconstruct Original Digits from English

    Given a non-empty string containing an out-of-order English representation of digits 0-9, output the ...

随机推荐

  1. 80X86寄存器详解<转载>

    引子 打算写几篇稍近底层或者说是基础的博文,浅要介绍或者说是回顾一些基础知识, 自然,还是得从最基础的开始,那就从汇编语言开刀吧, 从汇编语言开刀的话,我们必须还先要了解一些其他东西, 像  CPU ...

  2. html里id和name的异同

    id与name的作用,作为标签的标识符,基本上是一样的. name是老方法,id是在name基础上发明的,比name“现代化”一点,用的范围广一点 <...>中的name原来(刚发明时)就 ...

  3. SSIS之数据流任务

    数据流任务主要用于运行数据流以提取.转换.加载源数据.一个包中可以有多个数据流任务,也可以包含零个数据流任务.下面关系图显示含有一个数据流任务的包: 了解数据流任务后,我们就简要的学习一下如何创建数据 ...

  4. node中的加密模块 crypto

    crypto 加密模块(不是很安全):是使用md5来加密,这是node自带的模块,不需要安装. 引入模块: const crypto = require('crypto'); 当用户注册时,我们将从前 ...

  5. 如果看看机器ip和域名ip

    1.如果查看一个机器IP ifconfig或hostname -i //linux ipconfig //windows 2.查看一个域名对应ip ping www.baidu.com 下面会显示域名 ...

  6. 【WCF】利用WCF实现上传下载文件服务

    引言     前段时间,用WCF做了一个小项目,其中涉及到文件的上传下载.出于复习巩固的目的,今天简单梳理了一下,整理出来,下面展示如何一步步实现一个上传下载的WCF服务. 服务端 1.首先新建一个名 ...

  7. BEC listen and translation exercise 8

    The double-decker plane that can carry over 550 passengers dwarfs all other commercial jets. In just ...

  8. uva1152 - 4 Values whose Sum is 0(枚举,中途相遇法)

    用中途相遇法的思想来解题.分别枚举两边,和直接暴力枚举四个数组比可以降低时间复杂度. 这里用到一个很实用的技巧: 求长度为n的有序数组a中的数k的个数num? num=upper_bound(a,a+ ...

  9. CodeForces - 794C:Naming Company(博弈&简单贪心)

    Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little thi ...

  10. 使用Snapdragon Profiler工具分析

    http://blog.csdn.net/cgx090902/article/details/73849202 Snapdragon Profiler(骁龙分析器)是一款性能分析软件,在Windows ...