08 2017 档案

摘要:题目描述 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 言叶之之庭 阅读(141) 评论(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 言叶之之庭 阅读(206) 评论(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 言叶之之庭 阅读(132) 评论(0) 推荐(0)
摘要:题目描述 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime c 阅读全文
posted @ 2017-08-26 21:40 言叶之之庭 阅读(153) 评论(0) 推荐(0)
摘要:题目描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are+,-,*,/. Each operand may be an integer or another 阅读全文
posted @ 2017-08-26 21:23 言叶之之庭 阅读(125) 评论(0) 推荐(0)
摘要:题目描述 Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the neare 阅读全文
posted @ 2017-08-26 20:53 言叶之之庭 阅读(166) 评论(0) 推荐(0)