How to remove duplicates from a vector of characters in Rust

1 Answer

0 votes
fn main() {
    let mut v = vec!['a', 'a', 'b', 'b', 'b', 'c', 'c'];
    
    v.dedup();
  
    println!("{:?}", v);
}
  
  
  
  
/*
run:
  
['a', 'b', 'c']
  
*/

 



answered Feb 6, 2023 by avibootz

Related questions

...