美团前端暑实二面 & 春招总结
一面见这里
面经
时间:3-17
聊天
- 自我介绍
- 喜欢哪里base
- 为什么学前端
- 你觉得前端和其它方向的差异
- 前端重要的知识有哪些方面
有些问题忘记了,还是比较轻松的。技术问题不太记得,就记得问了个常见状态码。
代码考核
顺时针打印矩阵
const printer = (mat)=>{
const m = mat.length
const n = mat[0].length
const book = Array.from({length:m},()=>new Array(n).fill(0))
const res = []
const steps = [
[0,1],[1,0],[0,-1],[-1,0]
]
let stepIndex = 0
const total = m*n
let currX = 0,currY = 0
for(let i=0;i<total;i++){
res[i] = mat[currX][currY]
book[currX][currY] = 1
let nextX = steps[stepIndex][0]+currX
let nextY = steps[stepIndex][1]+currY
if(nextX>=m||nextY>=n
|| nextX<0||nextY<0
|| book[nextX][nextY]===1
)
{
stepIndex = (stepIndex+1)%4
nextX = steps[stepIndex][0]+currX
nextY = steps[stepIndex][1]+currY
}
currX=nextX
currY = nextY
}
console.log(res)
return res
}
写的第一版代码的可读性比较差,在和面试官的讨论下优化了一点,然后又问如果要给这个函数写测试用例,该考虑哪些情况?
二叉树的三种遍历
const preOrder = (node, res) => {
if (node === null) return;
res.push(node.value);
preOrder(node.left);
preOrder(node.right);
};
const midOrder = (node, res) => {
if (node === null) return;
midOrder(node.left);
res.push(node.value);
midOrder(node.right);
};
const beOrder = (node, res) => {
if (node === null) return;
beOrder(node.left);
beOrder(node.right);
res.push(node.value);
};
const travel = (root, solution) => {
const res = [];
solution(root, res);
return res;
};
组织代码用了一点策略模式。然后一开始把travel写在了最上面,面试官提醒如果travel在order函数之前调用会报错,我表示可以把三个order移上去或者把箭头函数改成function,然后问了下为什么第二种方法可以。
闲聊&反问
- 大学有没有参加什么组织?
- 在班上有没有当什么干部?
- 反问: 实习生可以参与什么样的工作。
二面总结
二面面试官依旧比较和蔼,聊得很开心,当时面完就觉得基本过了。
二面当天后的第一个工作日hr加了wx,又过一两天发了offer。美团效率真滴高,面试体验很舒服。
春招总结
投递: 美团(oc)、百度(oc)、阿里(阿里云一面挂,被捞,本地生活二面挂)、腾讯(四面挂)、字节(简历筛选...)
13号-18号一周面了12轮,面麻了,感受就是各家的面试官还是比较注重基本功以及临场应变能力。最后祝大家面试顺利!
#我的实习日记##大家都开始春招面试了吗##实习##美团##面经#
查看5道真题和解析