diff --git a/rust/0019-remove-nth-node-from-end-of-the-list.rs b/rust/0019-remove-nth-node-from-end-of-the-list.rs deleted file mode 100644 index a6787d021..000000000 --- a/rust/0019-remove-nth-node-from-end-of-the-list.rs +++ /dev/null @@ -1,26 +0,0 @@ -impl Solution { - pub fn remove_nth_from_end(head: Option>, n: i32)-> Option> { - let mut list_len=0; - let mut cur=&head; - while let Some(node)=cur{ - list_len+=1; - cur=&node.next; - } - let mut ans=Some(Box::new(ListNode{ - val:1, - next:head - })); - let mut list=&mut ans; - let mut pos=0; - while let Some(node)=list{ - if pos==list_len-n{ - node.next=node.next.clone().unwrap().next.take(); - break; - } - pos+=1; - list=&mut node.next; - } - ans.unwrap().next.take() - } -} -