摘要:
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3-> 阅读全文
摘要:
Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 阅读全文
摘要:
Follow up: Could you do it in O(n) time and O(1) space?/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL... 阅读全文
摘要:
Example: Given 1->2->3->4->5->NULL, return 1->3->5->2->4->NULL. //The program should run in O(1) space complexity and O(nodes) time complexity. //Plea 阅读全文
摘要:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文