当前位置:网站首页>字节日常实习(已OC)
字节日常实习(已OC)
2022-04-21 22:05:00 【veggie_a_h】
字节日常实习一面(已OC)
4.13.晚上7点(1个半小时)
他们公司多是react框架+自己封装hooks
- 自我介绍+项目介绍
- 问微前端子应用父应用怎么相关联以及微前端的核心实现
- 判断类型的几种方式
- 手写instanceof的实现
//迭代实现
function instanceOf(obj,constructor){
//取constructor的原型
let prototype = constructor.prototype;
//取obj的原型
obj = obj.__proto__;
while(true){
if(obj === prototype)
return true;
obj = obj.__proto__;
if(obj === null)
return false;
}
}
- typeof的缺点
- 深克隆浅克隆
深拷贝实现:
方法1:使用混入的方法:
var obj = {
a:1,b:2}
var newObj = Object.assign({
},obj)
方法2:使用递归
-
盒子模型,使用场景
-
for in 和for of的区别
-
position的属性
-
ts的枚举类型和对象的区别
-
vue和react的区别
-
制作一个扇形
。。。就想起来这么多
10. 字节日常实习二面
4.14.下午4点(1小时)
自我介绍+项目介绍
- 项目中在登录时,服务器端是怎么知道是哪个用户登录的(token)
- token是什么
- session是什么,和cookie、sessionStorage的区别
- CDN是什么
- 浏览器缓存
- tcp和udp的区别
- http和https的区别
-
// 注意象棋棋盘是7 * 7,然后象棋每次跳日
// let count = 0
function solution(x0, y0, xn, yn, n) {
// 递归出口
if (n == 0) {
if (x0 == xn && y0 == yn) {
// count++
return 1
}
return 0
}
let arr = getNextSteps(x0, y0)
let sum = 0
console.log(arr);
for (let i = 0; i < arr.length; i++) {
sum += solution(arr[i][0], arr[i][1], xn, yn, n - 1)
}
return sum
}
let c = solution(0, 0, 5, 6, 5)
// console.log(count);
console.log(c);
// 用于判断它的下一步跳的情况,在最中间时一共有8种跳跃情况
function getNextSteps(x, y) {
let arr = []
// 往第一象限跳
if (x <= 4 && y >= 1) {
arr.push([x + 2, y - 1])
}
if (x <= 5 && y >= 2) {
arr.push([x + 1, y - 2])
}
// 往第二象限跳
if (x >= 2 && y >= 1) {
arr.push([x - 2, y - 1])
}
if (x >= 1 && y >= 2) {
arr.push([x - 1, y - 2])
}
// 往第三象限跳
if (x >= 2 && y <= 5) {
arr.push([x - 2, y + 1])
}
if (x >= 1 && y <= 4) {
arr.push([x - 1, y + 2])
}
// 往第四象限跳
if (x <= 4 && y <= 5) {
arr.push([x + 2, y + 1])
}
if (x <= 5 && y <= 4) {
arr.push([x + 1, y + 2])
}
return arr
}
// let arr = getNextSteps(0, 0)
// console.log(arr);
- 写一下dfs的后续遍历求树所有节点的和
class Tree {
constructor(val, left, right) {
this.left = left == undefined ? null : left
this.right = right == undefined ? null : right
this.val = val == undefined ? 0 : val
}
}
// 后续遍历求节点和
function treeNode(root) {
if (!root) {
return 0
}
// console.log(root.val);
let left = treeNode(root.left) //一直遍历到左子树的叶子节点,由于叶子节点无左节点了,也就是其左节点为null了已经,所以就会返回0
let right = treeNode(root.right) // 返回0
let sum = left + right + root.val //拿到以当前节点为根的树的和
console.log(sum);
return sum
}
let tree = new Tree(1, new Tree(2, new Tree(4), new Tree(5)), new Tree(3))
console.log(treeNode(tree));
11.字节日常实习三面
没问啥。主要是写代码。
-
重新写了下二面没通过代码题跳马、还有后续遍历以及层序遍历求所有节点和。
-
使用二分查找查找一个先递增后递减数组的拐点索引。[1, 2, 3, 2, 1] => 2
版权声明
本文为[veggie_a_h]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wanghe1111_/article/details/124331286
边栏推荐
- 搭建本地Canal中间件进行数据迁移 —— 从缓存击穿得到的启发
- 数据库事务学习总结
- [WebGIS] Introduction to WebGIS, desktop GIS, mobile GIS and 3D GIS
- Leetcode0785. 判断二分图(medium,二分图,DFS)
- Eventbridge integrated cloud service practice
- 省选游记暨后期基础规划
- [ES6] deconstruction and assignment of variables
- 数据库设计与实现
- Idea operates redis on Linux through jedis; Failed to connect to any host resolved for DNS name
- 【ES6】Iterator和forof循环
猜你喜欢

联想公布ESG新进展:承诺2025年全线计算机产品100%含有再生塑料

Architecture document of outsourcing student management system

Oracle合并数据操作(MERGE)
![[canvas] basic drawing and use](/img/c2/8781a269863db93124467e92035895.png)
[canvas] basic drawing and use

Document de conception de l'architecture du système de gestion des étudiants externalisé

GD32F303学习笔记(1)——搭建环境、编译烧写

kotlin核心编程,Android开发面试解答之Handler

Leetcode0785. 判断二分图(medium,二分图,DFS)

MySQL is the most complete arrangement (interview questions + Notes + Guide Map), and the big interview companies are no longer stumped by mysql

Practice of JVM custom class loader in code extensibility
随机推荐
[best practice] patrol inspection item: local disk type inspection of cloud server (CVM) instance
ROS机器人从起点到终点(四)蓝桥云实践复现
IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolved for DNS name问题
Interview must brush algorithm top101 knapsack nine lectures Top13
redis配置文件详解
A thorough understanding -- > shell script
Push to origin / Master was rejected: error reporting solution
Online yaml to properties tool
【ES6】模块导入导出
[use case level definition]
基于Redis实现分布式锁的7种方案
【Canvas】基础绘制与使用
[ES6] string extension
Domestic API management artifact eolink, I love it
云原生微服务的下一站,微服务引擎 MSE 重磅升级
【ES6】let和const命令
【ES6】变量的解构赋值
期货在网上直接开户是否安全?
iphone测试,自定义tabbar的图片会跟着屏幕滑动
kotlin环境搭建,2021百度Android岗面试真题收录解析