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. 彻底弄清python的切片

    lis = range(100) # [0, 1, 2, 3, ..., 99] # 取前10个 lis[:10] # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # 取后10个 l ...

  2. OpenGL的镶嵌

    镶嵌(tessellation)是将凹边形分割或者是凸边形相交边组成的多边形.因为OpenGL只接受凸多边形的渲染,这些非凸多边形必须在绘制前进行镶嵌. 上图分别为凹四边形.中间有洞及自交的多边形. ...

  3. EF4 Model 代码生成EFPowerTools,Vs2015不支持,自己封装一个

    Vs2013上面有个插件EFPowerTools,用来生产entity实体代码的.目前官方只支持到Vs2013,虽然经过网上网友的方法,修改支持版本号,可以在Vs2015上安装.安装后连接远程数据库还 ...

  4. php 执行结果可以直接重定向文件中

    将php中的echo输出到shell上的结果,重定向到文件中. php script.php >result.txt;

  5. Python学习之路day4-列表生成式、生成器、Iterable和Iterator

    一.列表生成式 顾名思义,列表生成式就是用于生成列表的特殊语法形式的表达式. 1.1 语法格式 [exp for iter_var in iterable] 工作过程: 1.通过iter_var迭代i ...

  6. JavaScript如何处理解析JSON数据详解

    JSON (JavaScript Object Notation)一种简单的数据格式,比xml更轻巧. JSON 是 JavaScript 原生格式,这意味着在 JavaScript 中处理 JSON ...

  7. Oracle常见的33个等待事件

    Buffer busy waits 原因:        当一个会话试图修改一个数据块,但这个数据块正在被另一个会话修改时.        当一个会话需要读取一个数据块,但这个数据块正在被另一个会话读 ...

  8. JIRA 的安装和使用

    需要的软件 6.0.3-x32.exe jira_6.x_language_zh_CN.jar jira_crack.zip http://pan.baidu.com/s/1dEbpJc1 (从网盘下 ...

  9. 又是毕业季1&&又是毕业季2

    又是毕业季2 n/k; 又是毕业季2 一开始很容易想到枚举n个数取k个的所有组合,然后分别用辗转相除法求最大公约数,但是复杂度明显不符合要求,于是必须换一种思路. 我们想到,k个数的公约数含义就是这k ...

  10. C++ const 常量和常指针

    常量,该指针所指向的值为只读 ; const int * p = &a; 常指针,该指针的值为只读,不可再指向其他地址 const * const p = &a; 常值,常指针 con ...