摘要: 题目: Given a binary tree, return the preorder traversal of its nodes' values. 思路: 二叉树的前序遍历一般分为递归和非递归两种,非递归通过栈来存储节点。 代码: 递归: 循环: 阅读全文
posted @ 2018-01-14 23:17 Sindyang 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 题目: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 思路: 这道题看起来并不难,但是有很多需要注意的点,我用了很久的时间才通过这道题。大致的思路 阅读全文
posted @ 2018-01-14 20:27 Sindyang 阅读(132) 评论(0) 推荐(0) 编辑