由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个题Common Ancestor(不是tree)
相关主题
Hot startup coding test 的问题F家电面
问道G题(3)问一个树的题。
求助:如何删除已经merge到master上的文件?Longest common string问题
面试题请大家帮我看看,这个用什么数据结构好
google onsite经历Amazon问题请教+电面经验
问个题:判断两个人是不是genetically relatedAmazon 电面
Lowest Common Ancestor in a binary tree (no parent pointer)Graph DFS Iterative
请问LOWEST COMMON ANCESTOR OF A BINARY TREE, treenode 只有parent,没有left,rightanother interview question
相关话题的讨论汇总
话题: commit话题: string话题: ancestor话题: commits话题: parents
进入JobHunting版参与讨论
1 (共1页)
T******n
发帖数: 11
1
Implement a function that will find the most recent common ancestor of any
two commits from a given commit graph. The commit graph is represented as a
String[] called commits containing all commit IDs in sorted date order (most
recent first) and a String[][] called parents. The parent IDs for the
commit ID at index i can be found at parents[i]. The last item in the
parents array is always null since this represents the parent of the root
commit. For example, the following commit graph:
E - F
/ \
A -B - C - D - G
will be represented using:
String[] commits = {"G", "F", "E", "D", "C", "B", "A"};
String[][] parents ={{"F","D"},{"E"}, {"B"}, {"C"}, {"B"}, {"A"}, null};
If one commit is an ancestor of the other, return the commit that is the
ancestor
T******n
发帖数: 11
2
O(n)实现
1 (共1页)
进入JobHunting版参与讨论
相关主题
another interview questiongoogle onsite经历
悲催呀,A家要电话三面问个题:判断两个人是不是genetically related
请教word ladder解法,大test超时Lowest Common Ancestor in a binary tree (no parent pointer)
湾区公司店面请问LOWEST COMMON ANCESTOR OF A BINARY TREE, treenode 只有parent,没有left,right
Hot startup coding test 的问题F家电面
问道G题(3)问一个树的题。
求助:如何删除已经merge到master上的文件?Longest common string问题
面试题请大家帮我看看,这个用什么数据结构好
相关话题的讨论汇总
话题: commit话题: string话题: ancestor话题: commits话题: parents