File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ impl Solution {
1414 let n = citations. len ( ) ;
1515 let mut h = 0 ;
1616 let mut i = n - 1 ;
17- while i >= 0 && i < n && citations[ i] > h {
17+ while i < n && citations[ i] > h {
1818 h += 1 ;
1919 i -= 1 ;
2020 }
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ impl Solution {
77 // 这个题只用了删除,而没有替换或者插入操作
88 // 那么也就是意味着,我们只需要找出最长公共子序列(LCS)就可以了
99 // 这样保证双方保留的字符是最多的剩下的就是删除的
10- // 不过,如果有替换和插入操作,那么我们就需要使用编辑距离的解法了( Edit distance )
11- // AC 4ms 4.1mb 1306/1306
10+ // 当然最小编辑距离也是可以解决的( Edit Distance )
11+ // AC 0ms 4mb 1306/1306
1212 let n = word1. len ( ) ;
1313 let m = word2. len ( ) ;
14- let word1: Vec < char > = word1. chars ( ) . collect ( ) ;
15- let word2: Vec < char > = word2. chars ( ) . collect ( ) ;
14+ let word1 = word1. into_bytes ( ) ;
15+ let word2 = word2. into_bytes ( ) ;
1616 let mut dp = vec ! [ vec![ 0 ; m + 1 ] ; n + 1 ] ;
1717 for i in 1 ..=n {
1818 for j in 1 ..=m {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ pub struct ListNode {
66 pub next : Option < Box < ListNode > > ,
77}
88
9+ #[ allow( unused) ]
910impl ListNode {
1011 #[ inline]
1112 fn new ( val : i32 ) -> Self {
You can’t perform that action at this time.
0 commit comments