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 ...
随机推荐
- scheduler configuration options
Table 4.53. Description of scheduler configuration options Configuration option = Default value Desc ...
- Android当下最流行的开源框架总结
Android中能够简化开发流程的一些框架 本文介绍的是一些博主在开发过程中经常用到的Android开源框架,所谓开源框架我的理解就是别人封装好的代码,可以直接拿过来使用,并且源码也全部公开的代码库. ...
- Mac下git安装(使用Xcode)
(不使用Xcode的出门右转百度其他方法:比如直接安装git软件包.) 一.AppStore 最安全途径:搜索下载Xcode,(需要AppleID). 其他:直接百度Xcode下载. 二.Xcode ...
- 重置 Launchpad 和更新APP图标缓存
重置 Launchpad 方法一:在终端里粘贴 defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock 方法二:在终 ...
- SQLSERVER XML 类型列的模糊查询
select <column_name> from MyTable where <column_name>.value('(/root/sub-tag)[1]', 'varch ...
- JavaUtil_10_joda-time_用法入门
二.参考资料 1. Joda-Time 2.jodaTime 的使用说明 3.强大易用的日期和时间库 Joda Time
- Django REST_framework Quickstart
局部避免crsf的方式 针对视图函数: from django.views.decorators.csrf import csrf_exempt @csrf_exempt def foo(reques ...
- LeetCode Largest Palindrome Product
原题链接在这里:https://leetcode.com/problems/largest-palindrome-product/description/ 题目: Find the largest p ...
- LeetCode Reverse Words in a String III
原题链接在这里:https://leetcode.com/problems/reverse-words-in-a-string-iii/#/description 题目: Given a string ...
- Tomcat反带和集群
Nginx|Apache反带用户请求到Tomcat LNMT: client -->http --> nginx --> reverse_proxy --> http --&g ...