Snapchat OA 全流程分享|高頻題型 + 卡點複盤 + 遠端輔助實錄

2,875Views

Snapchat 其實在國內討論不算多,但在美國網路圈地位不低,尤其是它背後的技術堆疊和推薦系統在業界挺有名。崗位是 SDE New Grad,走的是標準的 OA + VO 流程。我投履歷後一週左右收到 OA 邀請,平台是 HackerRank,時間是 90 分鐘,三題,全英文介面。

我自己平常刷題不算特別系統,所以這次還是決定找 ProgramHelp 輔助一下,採用的是他們的「遠端無痕連線 + 即時語音提醒」服務。整個過程相當流暢,答題品質和效率都高了不少,也幫我避開了不少不必要的 debug 卡點。

Snapchat OA 全流程分享|高頻題型 + 卡點複盤 + 遠端輔助實錄

Snapchat OA 真題還原

Message Propagation in a Social Network

Problem Description:
You are given a list of users in a social network, represented as an adjacency list. Each user has a list of friends (bi-directional connections). One user (the “starter”) begins spreading a message to all of their friends at minute 0. In each subsequent minute, newlyinformed users pass the message on to their own friends (excluding the person they heard it from).

Your task is to determine the minimum number of minutes it takes for all users to receive the message. If some users can never receive the message (i.e., thenetwork is disconnected), return the list of unreachable users.

Function Signature:

def messageSpreadTime(graph: Dict[str, List[str]], starter: str) -> Union[int, List[str]]:

Example Input:

graph = {
    "A": ["B", "C"],
    "B": ["A", "D"],
    "C": ["A"],
    "D": ["B"],
    "E": ["F"],
    "F": ["E"]
}
starter = "A"

Example Output:

3  # A -> B/C (1) -> D (2); E/F unreachable
# OR
["E", "F"]

Follow-up Variation:
How would you design this if the graph is huge (millions of nodes) and distributed?

2. Event Compression

Problem Description:
You are given a list of user activity logs in the format [(timestamp1, userId1), (timestamp2, userId2), ...] sorted by timestamp. Users may appear multiple times.

Your task is to compress the log so that for each user, only their first and last appearance are kept.

Function Signature:

def compressLogs(logs: List[Tuple[int, str]]) -> List[Tuple[int, str]]:

Example Input:

logs = [
    (1, "u1"),
    (2, "u2"),
    (3, "u1"),
    (4, "u3"),
    (5, "u2"),
    (6, "u1")
]

Example Output:

[(1, "u1"), (6, "u1"), (2, "u2"), (5, "u2"), (4, "u3")]

Explanation:

u1 first at 1, last at 6 → keep 1 and 6

u2 first at 2, last at 5 → keep 2 and 5

u3 only appears once → keep 4

3. Longest Balanced Substring

Problem Description:
You are given a string consisting of only lowercase letters. A balanced substring is defined as one where the number of vowels and consonants are equal.

Your task is to return the length of the longest balanced substring.

Function Signature:

def longestBalancedSubstring(s: str) -> int:

Example Input:

s = "abcdeiou"

Example Output:

6  # "cdeiou"

Interview FAQ:關於 Snapchat OA,你可能也有這些疑問!

Q1:Snapchat 的 OA 都是什麼形式?是 LeetCode 原題嗎?

A:Snapchat OA 是在 Karat 平台上完成的,沒有攝影機監控,但後台有程式碼行為記錄。題目大多是「改編版」的 LeetCode 類型,強調實際業務背景,例如 log 壓縮、事件處理、平衡判斷等,不是純演算法套路刷題。和 TikTok、DoorDash 的風格有點類似,屬於偏場景化+演算法結合的類型。

Q2:題目難度如何?需要很強的演算法功底嗎?

A:整體難度中等偏下,關鍵在於你對hash map、prefix sum、sliding window、dict 操作這些要非常熟練,能很快在陌生業務背景下看出題目的本質。不是特別需要高深的 DP、圖論之類的高階演算法,但程式碼結構、穩健性要寫得乾淨。

Q3:時間夠用嗎?能用 Python 嗎?

A:時間是 70 分鐘做 3 題,基本上是夠的,尤其用 Python 會比較快。 Snapchat 的評測平台支援 Python3/Java/CPP,Python 是絕對推薦的,尤其是處理字串、dict、list 操作時非常有效率。

Q4:Snapchat 更重視演算法能力,還是程式碼工程化?

A:**Snap 的重點不是考你能不能寫出最優演算法,而是能不能寫出 robust 的業務邏輯程式碼。 **你寫的程式碼結構清晰、變數命名合理、能 cover edge case、解釋性強,遠比寫一個 obscure 的 one-liner 更有價值。

Q5:能重複提交嗎?會有 test case feedback 嗎?

A:Karat 平台支援本地 test case 測試,但不會顯示 hidden case 是否通過。每題一般允許多次提交(10次以內),但要避免花太多時間 Debug 一題導致時間不夠。

Q6:ProgramHelp 能提供什麼樣的輔助?

A:我們這邊可以提供 OA 線上遠端協助,包括:

全程無痕程式碼編寫支援(你在頁面上寫,我們即時協同在本地寫並語音提醒)

事先講解出題邏輯、題型套路,提升你 5 分鐘內識題 +拆題的能力

解題過程中,即時語音提示 bug 位置和修復建議,避免卡死

事後複盤你的代碼 + 補交簡潔解法,幫助你二輪面試更 smooth

最後一點建議 + ProgramHelp 助力上岸小tips

Snapchat 的 OA 屬於典型的「題幹看著複雜,其實考的是基本功」類型。只要你平常刷題基礎紮實,再加上對題意的快速拆解能力,其實通過並不難。關鍵在於:第一時間能識題、釐清邏輯、避免卡殼。

如果你時間緊,或是希望最大程度提升穩定性,我們 ProgramHelp 可以幫你做:

真題還原 + 高頻題型講解,事先熟悉出題套路

無痕遠程協助,手把手帶你寫,關鍵時刻語音提示避坑

面後代碼複盤 + follow-up 高效解法補充,一次過關不留遺憾

我們已經幫助無數同學順利上岸包括 Snapchat、Pinterest、TikTok、Databricks 在內的 top tech 公司,不想錯過機會的你,也可以來找我們聊聊你的狀況。

祝你早日上岸 Snapchat!面試路上,我們陪你走完最後一公里!

author avatar
Jack Xu MLE | 微軟人工智慧技術人員
Princeton University博士,人在海外,曾在Google、蘋果等多家大廠工作。深度學習NLP方向擁有多篇SCI,機器學習方向擁有Github千星⭐️專案。
END
 0