摘要: There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The player who take t 阅读全文
posted @ 2016-03-15 13:33 哥布林工程师 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. 思路: 分为两步 1. BFS,新建所有图中的node,用一个HashMap建立原来node和新的node之 阅读全文
posted @ 2016-03-15 13:20 哥布林工程师 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2016-03-15 12:18 哥布林工程师 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f 阅读全文
posted @ 2016-03-15 11:43 哥布林工程师 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Given the below binary tree: return 6.   一个二叉树的最大量 阅读全文
posted @ 2016-03-15 06:29 哥布林工程师 阅读(216) 评论(0) 推荐(0) 编辑