2024-9-2 美团一面

问题

  • 部门业务介绍,营销页面、node、react
  • 自我介绍
  • 低代码难点、封装了什么组件、嵌套层级怎么维护、撤销恢复怎么做
  • 小红书中台为什么用 qiankun,优点、场景、对比 iframe 的区别、收益
  • tailwind 配置,工程化插件
  • js 的原型和原型链
  • typeof 和 instanceof,以及原理
  • vue2 和 vue3 差别,响应式区别,对数组重写有什么区别
  • 闭包是什么,什么场景
  • js 内存回收机制(还不会)
  • react 和 vue 的 diff 算法区别,更新状态渲染的时候什么区别
  • useMemo 是干啥的,几个参数,什么用
  • 二叉树层序遍历,写出来了没问题
// 代码中已指定的类名、方法名、参数名,请勿修改,直接返回方法规定的值即可

/**
 * Definition for a binary tree node.
 * class TreeNode {
 *     val: number
 *     left: TreeNode | null
 *     right: TreeNode | null
 *     constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {
 *         this.val = (val===undefined ? 0 : val)
 *         this.left = (left===undefined ? null : left)
 *         this.right = (right===undefined ? null : right)
 *     }
 * }
 **/
function levelOrder(root: TreeNode | null): number[][] {
  if (!root) return []
  const queue: TreeNode[] = []
  queue.push(root)
  const ans: number[][] = []
  while (queue.length) {
    let len = queue.length
    let arr: number[] = []
    while (len--) {
      let node = queue.shift()
      arr.push(node.val)
      if (node.left) {
        queue.push(node.left)
      }
      if (node.right) {
        queue.push(node.right)
      }
    }
    ans.push(arr)
  }
  return ans
}

  • 嵌套对象搜索
// 查找位置
const map = [
  {
    label: '北京',
    value: '1',
    children: [
      {
        label: '北京',
        value: '2',
        children: [{ value: '3', label: '朝阳区' }],
      },
    ],
  },
  {
    label: '江苏',
    value: '4',
    children: [
      {
        label: '南京',
        value: '5',
        children: [{ value: '6', label: '朝阳区' }],
      },
    ],
  },
]

// 输入id,查找到对应的位置,并返回label
function dfs(id, arr) {
  for (let item of arr) {
    if (Number(item.value) === Number(id)) return item.label
    if (Number(item.value) < Number(id)) {
      continue
    } else {
      dfs(id, item.children)
    }
  }
}
function findAddress(id) {
  return dfs(id, map)
}

这个搜索理解有误差,实际上题目是,id 在每一级别是递增的,可以用二分搜索做

反问

  • node 写啥的 不是 bff,是直接查数据库的
  • base,上海
  • 工作强度 10:00 ~ 20:30

总结

中规中举,小部分不会。

#校招##美团##前端#
全部评论

相关推荐

4 9 评论
分享
牛客网
牛客企业服务