今天給大家update的信息是關於meta的,最近meta的效率變得很低,這兩天很多reschedule的case,並且很多case面完都沒有回音,有的hr明說了decision可能會拖到年後,大家稍安勿躁。
第一輪是白人男,兩道leetcode tag題。我們使用的python,為啥今天強調一下,埋個伏筆。
Meta VO
Meta面試第一道題很簡單
We have a nested list structure containing both integers and sub-lists (nested arrays). Each integer’s contribution to the final sum is multiplied by the depth level at which the integer is found. The depth of the top-levelintegers is 1, and if we go one level deeper, the integers there have a depth of 2, and so on. We need to compute the sum of all integers, each weighted by itsdepth.
Clarify的關鍵信息是,深度是不是從第一行開始,需要注意下為空的邊界條件。用遞歸,主函數里套了一個帶深度的dfs。然後code+ dry run, 加起來大概十分鐘秒了。
詳細思路是DFS遍歷列表:
- 逐一檢查列表中的元素。
- 如果元素是一個整數,將它的值乘以當前深度,累加到總和中。
- 如果元素是一個子列表,繼續DFS,同時將深度加1。
- 最後直接計算加權值並返回即可。
重点是第二道题
You are given a string Q consisting of parentheses () and []. A string of this type is said to be correct: (a) if it is the empty string
(b) if A and B are correct, AB is correct,
(c) if A is correct, (A) and [A] are correct.
Write a program that takes a sequence of strings of this type and check their correctness. Your program can assume that the maximum string length is 128.
題目是平衡括號,給的方法是stack+set的解法。這個解法時間、空間複雜度都是O(n),因為說的寫的都會很快。我們預設面試官會緊接著問有沒有空間O(1)的方法。就是leetcode solution的那個正著搜遍,反著搜一遍那個解。但需要一個temp來存儲結果。面試官聽懂算法了,但沒get到需要一個 list。
敲的時候被打斷,說有result存結果,不算O(1)。我們提供的是python解法,python的字符串是immutable的,所以原地改輸入也是額外的空間複雜度。然後面試官手動把輸入變成了mutable的 (list)。
敲完之後,面試官問了empty case,說正常處理返回empty,然後他不懂python,問下面這行第三個參數是啥,我們說是往回step,for read index in range(length-1,-1,-1):他覺得這一行代碼可以處理 empty case非常magic,然後我解釋了一下這行代碼怎麼處理的 empty case。
他问你一开始就知道嘛.”对,我一开始就知道,这是反向遍历一个list的best practice.”
面试官很满意,完美.
Meta系统设计面试(SD)
系统设计环节通常45分钟,考察你的系统理解、产品能力设计等问题。系统设计需要展示你在大型系统架构中的思维方式。
設計一個ticket master。
我們梳理好user flow,畫一個各個component都有的圖就行了。
需求如下:
- 如何處理短時間內大量人搶票的場景
- 如何給買票界面有一個timeout,超過一定時間沒付款怎麼處理
- 票都賣完了怎麼處理
- 如何確保付款的人一定拿得到票
- 如何實現一個waitlist,如果有人退票了優先通知waitlist上靠前的人
以上就是本次Meta兩輪Coding,一輪System design的VO真題分享。
聯絡我們
我們提供OA代寫、meta VO輔助面試和麵試代面的服務。對於OA代寫服務,我們將確保您獲得滿分。 VO輔助、VO代面對口型通過率80%+,馬上聯繫我們吧。