diff --git "a/problems/0024.344円270円244円344円270円244円344円272円244円346円215円242円351円223円276円350円241円250円344円270円255円347円232円204円350円212円202円347円202円271円.md" "b/problems/0024.344円270円244円344円270円244円344円272円244円346円215円242円351円223円276円350円241円250円344円270円255円347円232円204円350円212円202円347円202円271円.md" index 2c171dde91..ab204d8974 100644 --- "a/problems/0024.344円270円244円344円270円244円344円272円244円346円215円242円351円223円276円350円241円250円344円270円255円347円232円204円350円212円202円347円202円271円.md" +++ "b/problems/0024.344円270円244円344円270円244円344円272円244円346円215円242円351円223円276円350円241円250円344円270円255円347円232円204円350円212円202円347円202円271円.md" @@ -409,7 +409,7 @@ impl Solution { // 递归 impl Solution { pub fn swap_pairs(head: Option>) -> Option> { - if head == None || head.as_ref().unwrap().next == None { + if head.is_none() || head.as_ref().unwrap().next.is_none() { return head; } diff --git "a/problems/0452.347円224円250円346円234円200円345円260円221円346円225円260円351円207円217円347円232円204円347円256円255円345円274円225円347円210円206円346円260円224円347円220円203円.md" "b/problems/0452.347円224円250円346円234円200円345円260円221円346円225円260円351円207円217円347円232円204円347円256円255円345円274円225円347円210円206円346円260円224円347円220円203円.md" index 67070ba45a..ff476f4152 100644 --- "a/problems/0452.347円224円250円346円234円200円345円260円221円346円225円260円351円207円217円347円232円204円347円256円255円345円274円225円347円210円206円346円260円224円347円220円203円.md" +++ "b/problems/0452.347円224円250円346円234円200円345円260円221円346円225円260円351円207円217円347円232円204円347円256円255円345円274円225円347円210円206円346円260円224円347円220円203円.md" @@ -290,26 +290,21 @@ int findMinArrowShots(int** points, int pointsSize, int* pointsColSize){ ### Rust ```Rust -use std::cmp; impl Solution { pub fn find_min_arrow_shots(mut points: Vec>) -> i32 { if points.is_empty() { return 0; } points.sort_by_key(|point| point[0]); - - let size = points.len(); - let mut count = 1; - - for i in 1..size { - if points[i][0]> points[i-1][1] { - count += 1; - } else { - points[i][1] = cmp::min(points[i][1], points[i-1][1]); + let mut result = 1; + for i in 1..points.len() { + if points[i][0]> points[i - 1][1] { + result += 1; + } else { + points[i][1] = points[i][1].min(points[i - 1][1]) } } - - return count; + result } } ```

AltStyle によって変換されたページ (->オリジナル) /