一面
自我介绍
flex布局的一些属性使用方法
vue中
v-if和v-show的区别v-for中为什么使用keyvue中vnode的更新原理和时间复杂度
vue中为什么data要写成函数
vue中状态管理的方法(EventBus、provide)
rollup打包的好处
异步任务改成顺序执行
function foo() { Promise.all([request('http://some.url.1'), request('http://some.url.2')]).then((arr) => { return arr }).then((res) => { return request('http://some.url.3/v?='+res[0]+','+res[1]) }).then((r3) => { console.log(r3) }) }深度克隆
function deepClone(content) {
if (typeof content !== 'object') return
const res = Array.isArray(content) ? [] : {}
for (let key in content) {
let tmp = content[key]
if (typeof tmp === 'object') {
deepClone(tmp)
} else {
res[key] = tmp
}
}
return res
} - 微任务宏任务
console.log('1');
setTimeout(function() {
console.log('2');
process.nextTick(function() {
console.log('3');
})
new Promise(function(resolve) {
console.log('4');
resolve();
}).then(function() {
console.log('5')
})
})
process.nextTick(function() {
console.log('6');
})
new Promise(function(resolve) {
console.log('7');
resolve();
}).then(function() {
console.log('8')
})
setTimeout(function() {
console.log('9');
process.nextTick(function() {
console.log('10');
})
new Promise(function(resolve) {
console.log('11');
resolve();
}).then(function() {
console.log('12')
})
})
// [1,7,6,8,2,4,3,5,9,11,10,12] - 判断输出
var arr = ['0','1','2','3'] console.log(arr.map(parseInt)) // [0, NaN, NaN, NaN]
二面
- 自我介绍
- 问项目中遇到的问题
- http和websocket的比较
- 项目中选择echarts的原因
- 项目中的分工以及是如何和后端确定接口的
- 比较echarts和g2
- 笔试题中的第n个素数的解法,复杂度
- 笔试题中的根据对象生成标签
- 前序遍历 + 中序遍历确定二叉树
前: 1 2 4 7 3 5 6 8 中: 4 7 2 1 5 3 8 6
- 介绍排序算法,选择排序介绍、复杂度、稳定性
- 介绍哈夫曼树
- 机器人走格子
// 0 表示可通行, 1 表示不可通行
n = 5
m = 4
[
0 1 0 0
0 1 0 0
0 0 1 0
0 0 0 0
0 0 0 0
]
(0,0)-》(4,3)每次只能往右或者往下移动,一共有多少种走法
input:
n m
n*m
output:一共有多少种走法
function solve(n, m, arr) {
const dp = Array.from(new Array(n), () => Array.from(new Array(m), () => 0));
dp[0][0] = 1
for (let j = 1;j < n; j++) {
if (arr[0][j] === 0) {
dp[0][j] = dp[0][j - 1]
}
}
for (let i = 1;i < n; i++) {
if (arr[i][0] === 0) {
dp[i][0] = dp[i - 1][0]
}
}
for (let i = 1; i < n; i++) {
for (let j = 1; j < m; j++) {
if (arr[i - 1][j] === 1 && arr[i][j - 1] === 1) {
continue;
}
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
}
}
return dp[n - 1][m - 1]
}
全部评论
(7) 回帖