(附完整流程)字节跳动 前端 一二三面 + HR面(已意向)
三面汇总
1.输出题目 考察函数原型链的题目
function Animal(type, age) {
this.type = type;
this.age = age;
}
const cat1 = new Animal('cat', '2m');
Animal.getAllInfo = function () {
return `${this.type} ${this.age}`;
};
console.log(cat1.getAllInfo())
2.输出题目 考察闭包和作用域的题目
for(var i = 0; i < 5; i++) {
let out = i;
setTimeout(function() {
console.log(out);
}, 2000)
}
for(var i = 0; i < 5; i++) {
setTimeout(function(){
console.log(i);
}, 2000)
}
for(let i = 0; i < 5; i++) {
setTimeout(function(){
console.log(i);
}, 2000)
}
3.问了ES6相关的问题(Promise、Map、Set、Symbol、Bigint、let、const、async await之类的)
4.有关于Eventloop相关的问题
5.实现双飞翼布局和圣杯布局
6. 编程题 54. 螺旋矩阵
var spiralOrder = function (matrix) {
let rows = matrix.length, cols = matrix[0].length;
let top = 0, left = 0, right = cols - 1, bottom = rows - 1;
let order = [];
while(left <= right && top <= bottom) {
// 先去遍历top left -> top right;
for(let col = left; col <= right; col++) {
order.push(matrix[top][col]);
}
// 再去遍历top + 1 right -> bottom right
for(let row = top + 1; row <= bottom; row++) {
order.push(matrix[row][right]);
}
if (left < right && top < bottom) {
// 再去遍历bottom right - 1 -> bottom left
for(let col = right - 1; col > left; col--) {
order.push(matrix[bottom][col]);
}
// 再去遍历bottom left -> top + 1 left
for(let row = bottom; row > top; row--) {
order.push(matrix[row][left]);
}
}
// 最后分别改变l、r、t、b
[left, right, top, bottom] = [left + 1, right - 1, top + 1, bottom - 1];
}
return order;
};
7. 编程题 42. 接雨水
/**
* @param {number[]} height
* @return {number}
*/
var trap = function(height) {
// 先从左到右
let maxLeft = new Array().fill(0);
maxLeft[0] = height[0];
for(let i = 1; i < height.length; i++) {
maxLeft[i] = Math.max(maxLeft[i - 1], height[i]);
}
// 从右到左
let maxRight = new Array().fill(0);
maxRight[height.length - 1] = height[height.length - 1];
for(let i = height.length - 2; i >= 0; i--) {
maxRight[i] = Math.max(maxRight[i + 1], height[i]);
}
// 然后做取最小
let area = 0;
for(let i = 0; i < height.length; i++) {
area += Math.min(maxLeft[i], maxRight[i]) - height[i];
}
return area;
};
8. React相关的问题(hooks相关)
9. 性能优化系列(CDN、gzip、http2.0)
10. 前端工程化(Webpack相关)
11. Cookie相关(设置、更新、删除的方式、http only)和Session的区别
12. 编程题 200. 岛屿数量
/**
* @param {character[][]} grid
* @return {number}
*/
var numIslands = function (grid) {
if(!grid) {
return 0;
}
let rows = grid.length, cols = grid[0].length;
let ret = 0;
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
if (grid[i][j] === '1') {
ret++;
dfs(grid, i, j);
}
}
}
return ret;
};
var dfs = function (grid, i, j) {
if(i < 0 || j < 0 || i >= grid.length || j >= grid[0].length) {
return;
}
if (grid[i][j] === '0') {
return;
}
grid[i][j] = '0';
dfs(grid, i + 1, j);
dfs(grid, i - 1, j);
dfs(grid, i, j + 1);
dfs(grid, i, j - 1);
}
13. 编程题 手写深拷贝、访问对象的 a.b.c.d.e那道递归题
其他的忘记了 没有记录
流程:
1. 面试(技术面一共三轮,其中最后一面为ld面)(2天完成)
2. HR面试(有的部门可能没有)(1天)
3. HR通知面试通过,offer在审批阶段(1天)
4. offer审批通过,hr发放意向书(1天)
5. 9~11月份谈薪资(等待)
字节效率不得不说是真的快,中间一点拖拉都没有。

查看11道真题和解析