Skip to content

作业帮秋招一面

  1. 自我介绍。

  2. 实习经历详细介绍。

  3. 写 Prompt 的心得或者经验。

  4. 怎么提升首屏加载速度?

  5. 怎么做有利于 SEO?

    📌 回答

    • 基础结构方面:使用语义化标签;使用更规范的 URL 格式;添加 Sitemap。
    • 内容优化方面:优化 title/description 等 meta 标签;完善图片等的 alt 属性、优化内容大小来增强可访问性。
    • 技术策略方面:SSR/SSG 来代替 CSR 生成站点;首屏等加载策略优化;使用 JSON-LD 标注,提升结构性。
    • 前端实践方面:优化站内链接加速爬虫;懒加载等工程化知识。
  6. 简单说一下司内的登录流程。

  7. Session 和 Cookie 的区别。

  8. Vue 和 React 的优缺点。

  9. 介绍熟悉的设计模式和应用场景。

  10. 什么操作会导致内存泄漏?如何快速定位?

  11. 监控日志字节定位到项目、文件、函数哪个级别?

  12. 介绍 Promise 的链式调用。

  13. 介绍浏览器的事件循环。

  14. 简单说一下防抖和节流。

  15. 讲一下跨域。

  16. Get 和 Post 的区别?为什么 Get 更安全?

  17. 数字转 IP。

🔍 展开代码
1.js
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"));

📌 提示

题目要求时空复杂度都在 O(n!),表达回溯以后面试官驳回于是没尝试……

结果答案**就是回溯……面试还是试试水吧别被唬了……

  1. 对所有根节点到叶子节点的路径,作 ID 序列的求和。

如下图,结果为 124 + 125 + 136 = 385

🔍 展开代码
2.js
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));
  1. 「反问」业务和技术栈。