摘要: ```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: int ... 阅读全文
posted @ 2018-07-28 22:18 一条图图犬 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 两种思路,第一种就是在数组两边放置两个指针,第二种是在数组左边放置两个快慢指针。第二种方法更简洁,并且可以扩展至单链表的情形。推荐使用 C++ include include include include include include include include include using 阅读全文
posted @ 2018-07-28 22:05 一条图图犬 阅读(2124) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: int ... 阅读全文
posted @ 2018-07-28 12:21 一条图图犬 阅读(442) 评论(0) 推荐(0) 编辑
摘要: ```python3 """ # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def maxDepth(... 阅读全文
posted @ 2018-07-28 00:36 一条图图犬 阅读(554) 评论(0) 推荐(0) 编辑