Rust 0 ms solution
rust\nimpl Solution {\n    pub fn remove_nth_from_end(head: Option<Box<ListNode>>, n: i32) -> Option<Box<ListNode>> {\n        let mut dummy_head = Some(Box::ne
```rust\nimpl Solution {\n    pub fn remove_nth_from_end(head: Option<Box<ListNode>>, n: i32) -> Option<Box<ListNode>> {\n        let mut dummy_head = Some(Box::new(ListNode {\n            val: 0, next: head,\n        }));\n        let mut len = 0;\n        {\n            let mut p = dummy_head.as_ref();\n            while p.unwrap().next.is_some() {\n                len += 1;\n                p = p.unwrap().next.as_ref();\n            }\n        }\n        let idx = len - n;\n        {\n            let mut p = dummy_head.as_mut();\n            for _ in 0..(idx) {\n                p = p.unwrap().next.as_mut();\n            }\n            let next = p.as_mut().unwrap().next.as_mut().unwrap().next.take();\n            p.as_mut().unwrap().next = next;\n        }\n        dummy_head.unwrap().next\n    }\n}\n```\nAfter hours figting with borrow checker, I think the "One Pass" algorithm cannot be written in Rust without `unsafe`. \nBut actually the two pass solution is just as fast as one pass solution (times of moving pointer should be same), so just take it.
[]