字节跳动-抖音-一面面经
1.输入url到网页显示的具体过程
2.js怎么解析的
3.3次握手
算法
1.js实现两个链表的第一个公共节点
function FindFirstCommonNode(pHead1, pHead2)
{
// write code here
if (!pHead1 || !pHead2) {
return null
}
let arr1 = []
let arr2 = []
while (pHead1) {
arr1.push(pHead1)
pHead1 = pHead1.next
}
while (pHead2) {
arr2.push(pHead2)
pHead2 = pHead2.next
}
let i = arr1.length - 1
let j = arr2.length - 1
let same = null
while (i >= 0 && j >=0) {
if (arr1[i] === arr2[j]) {
same = arr1[i]
}
i--
j--
}
return same
}
2.https://zoyi14.smartapps.cn/pages/note/index?_swebfr=1&slug=e950f63dafed&origin=share&hostname=baiduboxapp
{
// write code here
if (!pHead1 || !pHead2) {
return null
}
let arr1 = []
let arr2 = []
while (pHead1) {
arr1.push(pHead1)
pHead1 = pHead1.next
}
while (pHead2) {
arr2.push(pHead2)
pHead2 = pHead2.next
}
let i = arr1.length - 1
let j = arr2.length - 1
let same = null
while (i >= 0 && j >=0) {
if (arr1[i] === arr2[j]) {
same = arr1[i]
}
i--
j--
}
return same
}
2.https://zoyi14.smartapps.cn/pages/note/index?_swebfr=1&slug=e950f63dafed&origin=share&hostname=baiduboxapp
3.
var value = 1;
function foo() {
console.log(value);
}
function bar() {
var value = 2;
foo();
}
bar();
#面经##校招##字节跳动##前端工程师#function foo() {
console.log(value);
}
function bar() {
var value = 2;
foo();
}
bar();