2024年美团技术平台前端工程师的面试初面反馈

243 阅读2分钟

image.png 超好体验,虽然没有准备好,但是每个问题面试官都在肯定,下次还来,哈哈,申请再来一次的机会

Part1: 1、介绍过往项目经历,解决过的难题,低代码是什么东西?低代码平台包括哪些模块?核心模块有哪些?

Part2: 1、由于我的经历有提及微信小程序?就问了,微信小程序相关的: 1、wxml 编译后是什么?(编译后还是html),为什么不直接使用html,wxml 有什么作用呢?微信小程序运行的环境有什么不同嘛?为什么采用双线程模型?

Part3:
1、 怎么让css动画加速?怎么开启浏览器GPU加速?

Part4:

1、怎么在react 实现 vue 的keep-alive 的功能,vue-router 实现原理,vue 的key 的作用,vuex 的设计模式,由于本人回答了观察者模式,然后就被问观察者模式与发布订阅模式有啥区别?(gg 忘记了)

part5-算法题:

1、手写简单发布订阅

class Event{
  constructor(){
    this.list={}
  }
  on(name,fn){
    if(!this.list[name]){
      this.list[name] = []
    }
    this.list[name].push(fn)
  }
  emit(name,data){
    this.list[name] && this.list[name].forEach(fn=>fn(data))
  }
}
const event = new Event()
event.on('卖房',function(price){
  if(price>=500){
    console.log(`现在房价${price}万。太高了,再等等吧`)
  }else{
    console.log(`现在房价${price}万。赶紧通知BCD买房`)
  }
})
event.emit('卖房',550)
setTimeout(()=>{event.emit('卖房',520)},1000)
setTimeout(()=>{event.emit('卖房',450)},1000)

2、二叉树的层序遍历,题目如下

image.png 推荐:11道精选经典LeetCode例题让你彻底搞懂二叉树的广度优先遍历_二叉树遍历典型例题-CSDN博客

class TreeNode{
  constructor(val,left,right){
    this.val = val;
    this.left = left;
    this.right = right
  }
}
class BinaryTreeLevelOrderTraversal{
      constructor(){
        this.resList=[]
      }
      // BFC,广度优先遍历
      levelOrderBFS(root){
        this.resList = [] // 初始化结果列表
        if(!root){
          return this.resList;
        }
        const queue = [root]
        while(queue.length){
          const levelSize = queue.length;
          const level=[];
          for(let i=0;i<levelSize;i++){
            const node = queue.shift()
            level.push(node.val)
            if(node.left){
              queue.push(node.left)
            }
            if(node.right){
              queue.push(node.right)
            }
          }
          this.resList.push(level)
        }
        return this.resList
      }
}
// 使用示例
const root = new TreeNode(3,new TreeNode(9))
root.right = new TreeNode(20,new TreeNode(15),new TreeNode(7))

const traversal = new BinaryTreeLevelOrderTraversal();
console.log('BFS',traversal.levelOrderBFS(root))

大致是这些,从来不打有准备的仗,欢迎大家讨论,一起讨论一起进步