189. 轮转数组
This commit is contained in:
+3
-3
@@ -1,12 +1,12 @@
|
||||
pub fn make_arr(s: &str) -> Vec<Option<i32>> {
|
||||
pub fn make_arr(s: &str) -> Vec<i32> {
|
||||
s.trim_matches(&['[', ']'][..])
|
||||
.split(',')
|
||||
.map(|x| {
|
||||
let x = x.trim();
|
||||
if x == "null" {
|
||||
None
|
||||
-1
|
||||
} else {
|
||||
Some(x.parse::<i32>().unwrap())
|
||||
x.parse::<i32>().unwrap()
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user