import { ListNode } from './LinkList' ; param { ListNode } head param { number } n return { ListNode } function DeleteNFromEnd ( head , n ) { if ( ! head || n <= 0 ) { return null ; } let node = new ListNode ( 0 , null ) ; node . next = head ; let a = node ; let b = node ; let c = null ; for ( let i = 0 ; i < n ; i ++ ) { a = a . next ; if ( ! a ) { return null ; } } while ( a ) { c = b ; b = b . next ; a = a . next ; } c . next = c . next . next ; return node . next ; } export default DeleteNFromEnd ;