摘要: 题目描述 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 farth 阅读全文
posted @ 2017-08-27 14:37 言叶之之庭 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 思路:注意垂直和重叠的点 代码 时间341ms 空间19988k /** * Defini 阅读全文
posted @ 2017-08-27 14:17 言叶之之庭 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Sort a linked list in O(n log n) time using constant space complexity. 思路:时间复杂度为O(nlogn),空间复杂度为常数,用归并排序 在下的代码 时间1162ms 空间27696k /** * Definition 阅读全文
posted @ 2017-08-27 12:09 言叶之之庭 阅读(120) 评论(0) 推荐(0) 编辑