作业帮秋招一面
自我介绍。
实习经历详细介绍。
写 Prompt 的心得或者经验。
怎么提升首屏加载速度?
怎么做有利于 SEO?
📌 回答
- 基础结构方面:使用语义化标签;使用更规范的 URL 格式;添加 Sitemap。
- 内容优化方面:优化 title/description 等 meta 标签;完善图片等的 alt 属性、优化内容大小来增强可访问性。
- 技术策略方面:SSR/SSG 来代替 CSR 生成站点;首屏等加载策略优化;使用 JSON-LD 标注,提升结构性。
- 前端实践方面:优化站内链接加速爬虫;懒加载等工程化知识。
简单说一下司内的登录流程。
Session 和 Cookie 的区别。
Vue 和 React 的优缺点。
介绍熟悉的设计模式和应用场景。
什么操作会导致内存泄漏?如何快速定位?
监控日志字节定位到项目、文件、函数哪个级别?
介绍 Promise 的链式调用。
介绍浏览器的事件循环。
简单说一下防抖和节流。
讲一下跨域。
Get 和 Post 的区别?为什么 Get 更安全?
数字转 IP。
🔍 展开代码
js
function getIps(s) {
const result = [];
function backtrack(start, path) {
if (path.length === 4) {
if (start === s.length) {
result.push(path.join("."));
return;
}
}
for (let len = 1; len <= 3; len++) {
if (start + len > s.length) break;
const segment = s.substring(start, start + len);
if (segment.length > 1 && segment.charAt(0) === "0") continue;
if (parseInt(segment, 10) > 255) continue;
path.push(segment);
backtrack(start + len, path);
path.pop();
}
}
backtrack(0, []);
return result;
}
console.log(getIps("25525511135"));
console.log(getIps("0000"));
console.log(getIps("00000"));📌 提示
题目要求时空复杂度都在
结果答案**就是回溯……面试还是试试水吧别被唬了……
- 对所有根节点到叶子节点的路径,作 ID 序列的求和。
如下图,结果为 124 + 125 + 136 = 385
🔍 展开代码
js
function getPath(node) {
if (!node) return [];
if (!node.left && !node.right) return [node.val]; // 面试少了这一行了
const paths = [];
if (node.left) {
const leftPaths = getPath(node.left);
for (const subPath of leftPaths) {
paths.push(`${node.val}${subPath}`);
}
}
if (node.right) {
const rightPaths = getPath(node.right);
for (const subPath of rightPaths) {
paths.push(`${node.val}${subPath}`);
}
}
return paths;
}
function sumNumbers(root) {
const paths = getPath(root);
const result = paths.reduce((sum, path) => +path + sum, 0);
return result;
}
class TreeNode {
constructor(val) {
this.val = val;
this.left = this.right = null;
}
}
const root = new TreeNode(1);
const node2 = new TreeNode(2);
const node3 = new TreeNode(3);
const node4 = new TreeNode(4);
const node5 = new TreeNode(5);
const node6 = new TreeNode(6);
root.left = node2;
root.right = node3;
node2.left = node4;
node2.right = node5;
node3.left = node6;
console.log(sumNumbers(root));- 「反问」业务和技术栈。
