s*n
2 楼
phone interview.
投的Software Development Intern
coordinator说要prepare to respond to behavioral questions.
会有什么behavioral问题呢?
投的Software Development Intern
coordinator说要prepare to respond to behavioral questions.
会有什么behavioral问题呢?
p*i
4 楼
上次来我学校听同学说好像就两道coding 题:
1. find the depth of a tree
2. check whether a linked list is circular or not.
1. find the depth of a tree
2. check whether a linked list is circular or not.
n*4
5 楼
just a little practice
1) find the depth of a tree
struct node {
int val;
node * firstChild;
node * nextSibling;
}
int depth(node * tree) {
int maxDepth=0;
node * p;
if (tree==NULL) return 0;
p = tree->firstChild;
while (p) {
maxDepth = max(depth(p),maxDepth);
p=p->nextSibling;
}
return maxDepth;
}
// time complexity: O(N) N the node number of the tree
// space complexity: O(1)
2) check whether a linked list is circular or not.
struct node {
int val;
node * next;
}
bool detectCircular(node * list) {
node * p1=list, * p2=list;
if (!list || !list->next) return false;
while (p2->next) {
p1=p1->next;
p2=p2->next->next;
if (p1==p2) return true;
}
return false;
}
1) find the depth of a tree
struct node {
int val;
node * firstChild;
node * nextSibling;
}
int depth(node * tree) {
int maxDepth=0;
node * p;
if (tree==NULL) return 0;
p = tree->firstChild;
while (p) {
maxDepth = max(depth(p),maxDepth);
p=p->nextSibling;
}
return maxDepth;
}
// time complexity: O(N) N the node number of the tree
// space complexity: O(1)
2) check whether a linked list is circular or not.
struct node {
int val;
node * next;
}
bool detectCircular(node * list) {
node * p1=list, * p2=list;
if (!list || !list->next) return false;
while (p2->next) {
p1=p1->next;
p2=p2->next->next;
if (p1==p2) return true;
}
return false;
}
相关阅读
求教:did I f*ked up my behavior questions?中美谈判搞得就象PIP【工作机会】西雅图 Grab SDE/DS positionsendorsement的作用有多大?阿里巴巴实习生没人恭喜zoom的同志们吗L家碰到这种recruiter怎么办洗脚哥今晚要被老婆奖励了 (转载)Python 开发岗位Chicago at Trading Firm面试基本上都挂了实习半年,我再也不想上班了面临PIP威胁,很郁闷,求教应对没接一个公司的offer,能马上申请他家的另外一个职位吗?警惕搞野鸡培训班的骗子!!!已经收满了- Software Engineer Internphone interview 技巧问题真的被porn网站联系了G家前员工,80后海归,拼多多黄峥身价高于李彦宏刘强东之和。一线E5还是二线M1?想起一个和小A一样的前同事去勾引领导