![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
程序员小马z
把别人的东西变为自己的东西!!!
展开
-
19. Remove Nth Node From End of List
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* removeNthFromEnd(struct ListNode* head, int n) { if(head==N...原创 2018-04-25 09:53:35 · 98 阅读 · 0 评论 -
237. Delete Node in a Linked List
问题描述: 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 -> 4 and you are given the...原创 2018-04-26 09:07:55 · 90 阅读 · 0 评论 -
21. Merge Two Sorted Lists
没通过自己写的代码:struct ListNode* mergeTwoLists(struct ListNode* l1, struct ListNode* l2) { struct ListNode* p=l1; struct ListNode* q=l2; struct ListNode* rear; struct ListNode* c=(struc...原创 2018-05-04 14:59:07 · 190 阅读 · 0 评论 -
206. Reverse Linked List
Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both?思路:头插法 该方法从一个空表开始,生成新结点,并将读取到的...原创 2018-04-27 15:25:48 · 322 阅读 · 0 评论 -
20. Valid Parentheses
bool isValid(char* s) { char stack[1000000]; //空字符串stack; int flag = -1; //标志位flag; while(*s){ //如果字符指针s的内容不为'\0',则执行循环; if(')' == *s){ //以下三...转载 2018-05-08 19:09:58 · 128 阅读 · 0 评论