上一页 1 2 3 4 5 6 7 8 ··· 11 下一页

2019年3月20日

617. Merge Two Binary Trees(归并两棵树)

摘要: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文

posted @ 2019-03-20 14:58 shaer 阅读(134) 评论(0) 推荐(0) 编辑

226. Invert Binary Tree(翻转树)

摘要: Invert a binary tree. Example: Input: Output: Trivia:This problem was inspired by this original tweet by Max Howell: 方法一:递归 时间复杂度:o(n) 空间复杂度:o(1) 阅读全文

posted @ 2019-03-20 14:38 shaer 阅读(247) 评论(0) 推荐(0) 编辑

543. Diameter of Binary Tree(两节点的最长路径)

摘要: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path betwe 阅读全文

posted @ 2019-03-20 11:40 shaer 阅读(82) 评论(0) 推荐(0) 编辑

110. Balanced Binary Tree(平衡树)

摘要: 110. Balanced Binary Tree Easy 108994FavoriteShare 110. Balanced Binary Tree Easy 108994FavoriteShare Easy Given a binary tree, determine if it is hei 阅读全文

posted @ 2019-03-20 11:28 shaer 阅读(87) 评论(0) 推荐(0) 编辑

104. Maximum Depth of Binary Tree(树的高度)

摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文

posted @ 2019-03-20 11:05 shaer 阅读(86) 评论(0) 推荐(0) 编辑

2019年3月19日

328. Odd Even Linked List(链表元素按奇偶聚集)

摘要: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文

posted @ 2019-03-19 23:07 shaer 阅读(149) 评论(0) 推荐(0) 编辑

234. Palindrome Linked List(回文链表)

摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: 题目要求:以 O(1) 的空间复杂度来求解。 切成两半,把后半段反转,然后比较两半是否相等。 时间复杂度:o(n) 空间复杂度:o(1 阅读全文

posted @ 2019-03-19 22:48 shaer 阅读(116) 评论(0) 推荐(0) 编辑

445. Add Two Numbers II(链表求和)

摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文

posted @ 2019-03-19 12:03 shaer 阅读(76) 评论(0) 推荐(0) 编辑

24. Swap Nodes in Pairs(交换链表中的相邻结点)

摘要: Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be ch 阅读全文

posted @ 2019-03-19 11:23 shaer 阅读(101) 评论(0) 推荐(0) 编辑

2019年3月18日

19. Remove Nth Node From End of List(删除链表中的第n个结点)

摘要: Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. 方法一:双指针 删除倒数第n个点,我们首先 阅读全文

posted @ 2019-03-18 23:23 shaer 阅读(119) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 11 下一页

导航