【电面】
电话面试弯曲职位,先是聊项目然后要求打印tree in order
很传统:先介绍简历 +
做题 + 问问题。
题目1:求二叉树所有从根开始到叶子的所有路径和。.
Waral 鍗氬鏈夋洿澶氭枃绔�,
题目2:不能用递归,完成以上题目。
还挺简单的~发面经求涨RP啊~~
刚刚结束的第二轮facebook电话面试。还没结果呢所以结果就先选的other~求
大米~~求offer~~~
.
鍥磋鎴戜滑@1point 3 acres
居然做了三个题目。。
小哥迟到了5分钟打过来,那五分钟真是内心煎熬啊。。。
真的非常感谢地里朋友,所以赶紧发面经了。
1. flood fill。感谢地里面经:
here and
here and
here
就上面题目的各种变种,题目是有一个矩阵
1代表已经染 {MOD},0代表没有染 {MOD}。
完成一个函数,
输入:矩阵a,整数x, 整数y
输出:
返回一个矩阵,为以(x,y)点(0-based)为开始点的染 {MOD}结果,将其周围区域染 {MOD},直到遇到已经染 {MOD}的位置或边界为止。
若(x, y)已经染 {MOD}则直接返回。注意:只能向上下左右四个方向染 {MOD}。
. 涓€浜�-涓夊垎-鍦帮紝鐙鍙戝竷
输入样例:
111111
111001
100110
2
1
输出样例:
111111
111001
111110
基本就是我在
这里楼下贴的程序一样。注意处理边界条件。我用的DFS。代码如下:
-
public class Solution {
-
private row = 0;
-
private col = 0;
-
. from: 1point3acres.com/bbs
-
public void fillBlack(int[][] a, int x, int y) {
-
if (a == null || x == null || y == null) {
-
return;
-
}. 鍥磋鎴戜滑@1point 3 acres
-
-
row = a.length;
-
col = a[0].length;. 鍥磋鎴戜滑@1point 3 acres
-
dfs(a, x, y);
-
}
-
-
public void dfs(int[][] a, int i, int j) {. 鐗涗汉浜戦泦,涓€浜╀笁鍒嗗湴
-
if (i < 0 || i >= row || j < 0 || j >= col || a[i][j] != 0) {
-
return;
-
}. from: 1point3acres.com/bbs
-
a[i][j] = 1;
-
dfs(a, i - 1, j);
-
dfs(a, i + 1, j);. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
-
dfs(a, i, j + 1);
-
dfs(a, i, j - 1);
-
-
}
-
-
-
}
复制代码
2. lintcode原题,merge two sorted array II. 连接请
点击这里。
.
涓€浜�-涓夊垎-鍦帮紝鐙鍙戝竷
我们从后往前走即可。注意如果B数组提前结束,那么A剩下的就是在原地,所以不用再变了~要求in-place
代码如下:
-
public class Solution {
-
public void mergeSortedArray(int[] a, int m, int[] b, int n) {. 鐗涗汉浜戦泦,涓€浜╀笁鍒嗗湴
-
if (a == null || b == null) {
-
return;
-
}
-
-
int pos = m + n - 1;
-
int i = m - 1;
-
int j = n - 1;
-
while (i >= 0 && j >=0) {
-
if (a[i] >= b[j]) {
-
a[pos] = a[i];.1point3acres缃�
-
i--;
-
} else {. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
-
a[pos] = b[j];
-
j--;
-
}
-
pos--;
-
}
-
-
if (i < 0) {
-
while (pos >= 0) {
-
a[pos] = b[j];. from: 1point3acres.com/bbs
-
j--;
-
pos--;
-
}. 1point3acres.com/bbs
-
}
-
}
-
}
复制代码
3. 感谢面经~这是二叉树经典题目 BST转换成循环双向链表。leetcode类似题目请点击这里:
Flatten Binary Tree to Linked List
其实我在面经贴:
这里下面给出了自己的代码了。
具体思路是:
1. 拿出根节点。
2. 递归处理left, 找到左边最后一个节点,并且连接root到这个节点上。
3. 递归处理right, 找到右边最前面的节点,并且连接root到这个节点上。
. 鍥磋鎴戜滑@1point 3 acres
4. return。
最后还需要处理一下头连接到尾巴的双向循环,补上就行,不贴code了。
-
public class SolutionConvert {
-
public void solve(TreeNode root) {
-
if (root == null) {
-
return;
-
}
-
convertToDoubleLinkedList(root); . From 1point 3acres bbs
-
}
-
. 涓€浜�-涓夊垎-鍦帮紝鐙鍙戝竷
-
public void convertToDoubleLinkedList(TreeNode root) {. 涓€浜�-涓夊垎-鍦帮紝鐙鍙戝竷
-
if (root == null) {. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
-
return;
-
}. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
-
if (root.left != null) {
-
TreeNode left = root.left;
-
convertToDoubleLinkedList(left);.鏈枃鍘熷垱鑷�1point3acres璁哄潧
-
while (left.right != null) {
-
left = left.right;
-
}
-
left.right = root;
-
root.left = left;
-
}
-
if (root.right != null) {
-
TreeNode right = root.right;
-
convertToDoubleLinkedList(right);
-
while (right.left != null) {.鐣欏璁哄潧-涓€浜�-涓夊垎鍦�
-
right = right.left;
-
}
-
right.left = root;
-
root.right = right;
-
}
-
}
-
. From 1point 3acres bbs
-
public void test(String[] args) {.1point3acres缃�
-
TreeNode a = new TreeNode("10");
-
TreeNode b = new TreeNode("12");
-
TreeNode c = new TreeNode("15");
-
TreeNode d = new TreeNode("25");
-
TreeNode e = new TreeNode("30");
-
TreeNode f = new TreeNode("36");
-
a.left = b;. 1point 3acres 璁哄潧
-
a.right = c;
-
b.left = d;
-
b.right = e;
-
c.left = f;.鐣欏璁哄潧-涓€浜�-涓夊垎鍦�
-
solve(a);
-
while (a.left != null) {
-
a = a.left;
-
}
-
while (a != null) {
-
System.out.print(a.val
+ " ");
-
a = a.right;. 1point3acres.com/bbs
-
}
-
}. more info on 1point3acres.com
-
}
复制代码
求赏大米~~求拿offer~~
. visit 1point3acres.com for more.
楼主在加拿大McGill University读thesis的硕士。
总体时间线是:2月5号在学校招聘会上投了F家的简历
2月10号收到面试邀请
3月4号完成第一轮电面, 面经
这里
3月20号完成第二轮电面,面经
这里。 当天晚上其实就收到邮件说下周要打电话,后来才知道就是发offer了。。。。
3月24号接到HR电话正式拿到offer。
申请的职位是做Product
Generalist软件开发岗。
在门罗公园总部。本来说门罗已经没坑了要放我到seattle,出于某种未知原因又把我放到总部?HR原话是说,觉得你更suitable总部。。 求大神解答。
实习时间一律12周。除非学校要求16周coop才给学分,比如waterloo。
5月初到7月末,中间每两周开一个新批次入职,大家可以随意选择。
offer的一小段如下:
On behalf of Facebook, Inc. (the “Company” or “Facebook”), I am pleased to offer you the position of
Software Engineer Intern at the Company. You will be working out of the Company’s
US
- CA - Menlo Park office
under the guidance of XXX. While working at Facebook, you’ll have the opportunity ............
. Waral 鍗氬鏈夋洿澶氭枃绔�,
Compensation:
a. Base Wage . In this position you will earn
a salary of $8*** per month. Your wages will be
payable in
two equal payments per month ........
鏉ユ簮涓€浜�.涓夊垎鍦拌鍧�. b. Relocation . You will be eligible for relocation benefits as outlined in Attachment C:
Airfare or Mileage Reimbursement
Shipping: reimburse you up to
$300 toward shipping of personal items
.1point3acres缃�Housing: place you in a
furnished apartment for the duration of your internship. The cost will
be direct billed to Facebook.
Or Housing Stipend : $1,000 / month
Transportation: we will provide a
rental bike, lock and safety helmet for you for the duration
of your internship.
. 鐣欏鐢宠璁哄潧-涓€浜╀笁鍒嗗湴
Facebook家情况简要介绍:
顶级互联网公司top2到3?员工平均股票市值数额是全球最高的。因为14年底只有9199名员工,然而G家有5万名。所以员工承担的责任maybe更大,创造的价值maybe更多?
每年新的全职和实习岗位从暑期结束就开始陆续放出。于是新学期一开学请立即开始找。不要像我一样2月份临时决定才开始。今年貌似刚好赶上F家扩招,所以机会还好。
F家北美研发中心有三个,分别是门罗公园总部,西雅图和纽约。当然各个州税不一样,规模也不同:
加州总部最大不用说了,条件最好,各种食堂免费,各种大牛在身边,出门左转
斯坦福。
西雅图规模第二,F刚刚购置了能容纳2000人的新办公室。城市很美气候多雨,而且微软和Amazon总部也都在那,其他产业,比如航空制造业也很发达,波音总部在那,所以人脉不一定是码农??
纽约规模最小但是地处东北,如果地理上有要求的小伙伴们可以考虑,具体不了解。
待遇如上,另外员工可以公司免费吃喝。估计要胖的节奏了== 另外周末活动多多,每周末貌似都有活动。求介绍。
职位方面,码农类职位分为产品(就是我做的)和后端(服务器端开发)。具体介绍是HR发给我的如下,就不翻译了。
基本意思就是一个做应用开发,比如网页前端、iOS或者Andriod,另一个是则是服务器后端开发。
◦ Product Generalist: an umbrella term for engineers that are passionate about designing and building engaging products. They will have
a solid understanding of application development technologies and work mostly on the front end designing and building something from end to end. These engineers will primarily end up in product, ads, mobile, platform or growth teams... but these types of skills
can be applicable in almost any team in Engineering.
◦ Systems
Generalist: those who develop the general components on which the website and products are built. These types of candidates will be proficient in writing code to solve large scale backend problems and be less inclined towards dealing with front end
development. The ideal candidate can write code in (but not limited to) C, C++, PHP and Python with strong experience in a Linux environment.
一路走来,我只能说感谢,也应该说只是运气好。我真的感谢各路神仙开恩,也感谢面试官没有为难我,更感谢地里面经。
也庆幸遇到的题目我多少还是会的以及面经里出现过的,所以结果还ok。我以后一定多做善事补补人品,可能人品都用光了
希望实习结束之后找全职工作顺利,希望能拿return offer,不拿也无所谓了。我人生已经混混乱不堪了其实。。以后可能写个帖子总结下。
.