LeetCode 423. Reconstruct Original Digits from English
2023-05-06 16:10 作者:您是打尖兒還是住店呢 | 我要投稿
Given a string?s
?containing an out-of-order English representation of digits?0-9
, return?the digits in?ascending?order.
?
Example 1:
Input: s = "owoztneoer"Output: "012"
Example 2:
Input: s = "fviefuro"Output: "45"
?
Constraints:
1 <= s.length <= 105
s[i]
?is one of the characters?["e","g","f","i","h","o","n","s","r","u","t","w","v","x","z"]
.s
?is?guaranteed?to be valid.
找呀找呀找規(guī)律;

這個(gè)是每個(gè)字符在數(shù)字中出線的信息,那么我們就要去根據(jù)專有的,去判斷其他共用的信息;
就是加減法了;然后就過了。。
Runtime18 ms
Beats
20.31%
Memory43.3 MB
Beats
29.30%
標(biāo)簽: