File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ impl Solution {
7070std强大的标准库 Vec上retain方法
7171
7272``` rust 
73- 
73+ #  struct   Solution  {} 
7474impl  Solution  {
7575    pub  fn  remove_element (nums :  & mut  Vec <i32 >, val :  i32 ) ->  i32  {
7676        nums . retain (| & x |  x  !=  val );
@@ -83,6 +83,7 @@ impl Solution {
8383slow指针用来存储需要留下元素应该存放的地址,fast指针是当前处理的元素
8484
8585``` rust 
86+ # struct  Solution  {}
8687impl  Solution  {
8788    pub  fn  remove_element (nums :  & mut  Vec <i32 >, val :  i32 ) ->  i32  {
8889        let  mut  slow :  usize  =  0usize  ;    //  the result elem
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl Solution {
9191-  ` Ordering::Less => { right = mid } `  要注意“右开” 又写错了
9292
9393``` rust 
94- 
94+ #  struct   Solution  {} 
9595use  std :: cmp :: Ordering ;
9696
9797impl  Solution  {
@@ -117,6 +117,7 @@ impl Solution {
117117使用rust std
118118
119119``` rust 
120+ # struct  Solution  {}
120121impl  Solution  {
121122    pub  fn  search (nums :  Vec <i32 >, target :  i32 ) ->  i32  {
122123        match  nums . binary_search (& target ) {
@@ -126,6 +127,9 @@ impl Solution {
126127    }
127128}
128129
130+ 
131+ ```rust 
132+ # struct  Solution  {}
129133impl  Solution  {
130134    pub  fn  search (nums :  Vec <i32 >, target :  i32 ) ->  i32  {
131135        let  idx :  usize  =  nums . partition_point (| & x |  x  <  target );
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments