1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:
编程语言 时间:
2020-04-03 12:22:52
阅读次数:
63
#include <stdio.h> #include <stdlib.h> typedef struct ListNode { int val; struct ListNode *next; }ListNode; ListNode* ReverseList(ListNode* pHead) { i ...
分类:
其他好文 时间:
2020-04-02 22:45:25
阅读次数:
56
题目描述: java /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class ...
分类:
其他好文 时间:
2020-04-02 17:39:14
阅读次数:
49
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu ...
分类:
其他好文 时间:
2020-04-01 16:35:39
阅读次数:
55
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:
其他好文 时间:
2020-04-01 15:00:17
阅读次数:
56
class Solution { public ListNode removeElements(ListNode head, int val) { //如果没有前置头,那么需要分是头还是链身 //给它加一个前置头哈哈 ListNode dummyHead=new ListNode(-1); //删除 ...
分类:
其他好文 时间:
2020-03-31 22:55:26
阅读次数:
63
#include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct listNode { int data; struct listNode *nextPtr; }LISTNODE; void instructions ( ...
分类:
其他好文 时间:
2020-03-28 14:59:45
阅读次数:
76
// 面试题24:反转链表 // 题目:定义一个函数,输入一个链表的头结点,反转该链表并输出反转后链表的 // 头结点。 #include <cstdio> #include "List.h" ListNode* ReverseList(ListNode* pHead) { ListNode* pR ...
分类:
其他好文 时间:
2020-03-27 01:08:33
阅读次数:
60
// 面试题18(一):在O(1)时间删除链表结点 // 题目:给定单向链表的头指针和一个结点指针,定义一个函数在O(1)时间删除该 // 结点。 #include <cstdio> #include "List.h" void DeleteNode(ListNode** pListHead, Li ...
分类:
其他好文 时间:
2020-03-24 23:38:24
阅读次数:
134
class Solution: def reversePrint(self, head: ListNode) -> List[int]: newList=[] while head: newList.append(head.val) head=head.next return newList[::- ...
分类:
编程语言 时间:
2020-03-24 11:03:57
阅读次数:
67