链接 Remove Nth Node From End of List 难度 Medium 描述 Given a linked list, remove the n -th node from the end of list and return its head. 给定一个链表,要求移除导数第n个元素,并且返回新链表的head 样例: Given linked list: **1- >2->3->4->5**, and **_n_ = 2**. After removing th…
2.2 Implement an algorithm to find the kth to last element of a singly linked list. 这道题让我们求链表中倒数第k个元素,LeetCode中相类似的题目有Kth Largest Element in an Array 数组中第k大的数字 和 Kth Smallest Element in a BST 二叉搜索树中的第K小的元素.但那两道题和这题又不一样,首先这道题是要在链表中操作,链表的特点就是不能通过下标来直接访…