5902. 检查句子中的数字是否递增

执行用时:4 ms, 在所有 Swift 提交中击败了100.00%的用户
内存消耗:14.1 MB, 在所有 Swift 提交中击败了100.00%的用户

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Solution {
func areNumbersAscending(_ s: String) -> Bool {
let array = s.split(separator: " ")
var last = Int.min
for item in array {
if let myInt = Int(item) {
if myInt > last {
last = myInt
}else{
return false
}
}
}
return true
}
}

5902. 检查句子中的数字是否递增
https://pisces34.github.io/2021/10/18/leetcode/5902/
发布于
2021年10月18日
许可协议