leetcode423
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的更多相关文章
- [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 ...
随机推荐
- NovaException: Unexpected vif_type=binding_failed
nova/virt/libvirt/vif.py: _("Unexpected vif_type=%s") % vif_type) NovaException: Unexpecte ...
- Win7使用之查端口,杀进程
对 Win7 的 cmd 使用不熟练,这里记录下经常用到的命令吧! 查看所有端口占用情况:netstat -ano 查看指定端口占用情况:netstat -ano | findstr "80 ...
- Jfinal整合百度富文本编辑器ueditor
ueditor配置文件ueditor.config.js修改参数serverUrl:(改为要调用的action) 后台代码 package com.sandu.mega.admin.ueditor; ...
- MySQL 事物和数据库锁
1.数据库事物 1. 什么是事务 事务是应用程序中一系列严密的操作,所有操作必须成功完成,否则在每个操作中所作的所有更改都会被撤消.也就是事务具有原子性,一个事务中的一系列的操作要么全部成功,要么一 ...
- Spring_总结_01_Spring概述
一.前言 从今天开始,重新总结一下Spring的相关知识,主要是结合<Spring实战(第四版)>和 <JavaEE开发的颠覆者——SpringBoot实战>这两本书以及官方文 ...
- Linux下添加,删除,修改,查看用户和用户组
linux下添加,删除,修改,查看用户和用户组 1,创建组 groupadd test 增加一个test组 2,修改组 groupmod -n test2 test 将test组的名子改成test ...
- @angular/cli项目构建--路由2
app.module.ts update const routes: Routes = [ {path: '', redirectTo: '/home', pathMatch: 'full'}, {p ...
- xdebug的安装测试
1.下载 php -version PHP 7.2.0 (cli) (built: Dec 7 2017 23:07:46) ( NTS DEBUG ) 如果PHP版本是7.2以上的必须要下载Xdeb ...
- python3中zip()函数的用法
>>>a = [1,2,3] >>> b = [4,5,6] >>> c = [4,5,6,7,8] >>> zipped = ...
- flash、js 函数 互相调用
js调用flex函数 flex 利用ExternalInterface.addCallback(“注册的方法名”,As中的函数名)进行注册 js中,用document.getElementById(“ ...