mle-interview
  • 面试指南
  • 数据结构与算法
    • 列表
      • 912. Sort an Array
      • 215. Kth Largest Element
      • 977. Squares of a Sorted Array
      • 605. Can Place Flowers
      • 59. Spiral Matrix II
      • 179. Largest Number
      • 31. Next Permutation
    • 二分查找
      • 704. Binary Search
      • 69. Sqrt(x)
      • 278. First Bad Version
      • 34. Find First and Last Position of Element in Sorted Array
      • 33. Search in Rotated Sorted Array
      • 81. Search in Rotated Sorted Array II
      • 162. Find Peak Element
      • 4. Median of Two Sorted Arrays
      • 1095. Find in Mountain Array
      • 240. Search a 2D Matrix II
      • 540. Single Element in a Sorted Array
      • 528. Random Pick with Weight
      • 1300. Sum of Mutated Array Closest to Target
      • 410. Split Array Largest Sum
      • 1044. Longest Duplicate Substring
      • *644. Maximum Average Subarray II
      • *1060. Missing Element in Sorted Array
      • *1062. Longest Repeating Substring
      • *1891. Cutting Ribbons
    • 双指针
      • 26. Remove Duplicate Numbers in Array
      • 283. Move Zeroes
      • 75. Sort Colors
      • 88. Merge Sorted Arrays
      • 167. Two Sum II - Input array is sorted
      • 11. Container With Most Water
      • 42. Trapping Rain Water
      • 15. 3Sum
      • 16. 3Sum Closest
      • 18. 4Sum
      • 454. 4Sum II
      • 409. Longest Palindrome
      • 125. Valid Palindrome
      • 647. Palindromic Substrings
      • 209. Minimum Size Subarray Sum
      • 5. Longest Palindromic Substring
      • 395. Longest Substring with At Least K Repeating Characters
      • 424. Longest Repeating Character Replacement
      • 76. Minimum Window Substring
      • 3. Longest Substring Without Repeating Characters
      • 1004. Max Consecutive Ones III
      • 1658. Minimum Operations to Reduce X to Zero
      • *277. Find the Celebrity
      • *340. Longest Substring with At Most K Distinct Characters
    • 链表
      • 203. Remove Linked List Elements
      • 19. Remove Nth Node From End of List
      • 876. Middle of the Linked List
      • 206. Reverse Linked List
      • 92. Reverse Linked List II
      • 24. Swap Nodes in Pairs
      • 707. Design Linked List
      • 148. Sort List
      • 160. Intersection of Two Linked Lists
      • 141. Linked List Cycle
      • 142. Linked List Cycle II
      • 328. Odd Even Linked List
    • 哈希表
      • 706. Design HashMap
      • 1. Two Sum
      • 146. LRU Cache
      • 128. Longest Consecutive Sequence
      • 73. Set Matrix Zeroes
      • 380. Insert Delete GetRandom O(1)
      • 49. Group Anagrams
      • 350. Intersection of Two Arrays II
      • 299. Bulls and Cows
      • *348. Design Tic-Tac-Toe
    • 字符串
      • 242. Valid Anagram
      • 151. Reverse Words in a String
      • 205. Isomorphic Strings
      • 647. Palindromic Substrings
      • 696. Count Binary Substrings
      • 28. Find the Index of the First Occurrence in a String
      • *186. Reverse Words in a String II
    • 栈与队列
      • 225. Implement Stack using Queues
      • 54. Spiral Matrix
      • 155. Min Stack
      • 232. Implement Queue using Stacks
      • 150. Evaluate Reverse Polish Notation
      • 224. Basic Calculator
      • 20. Valid Parentheses
      • 1472. Design Browser History
      • 1209. Remove All Adjacent Duplicates in String II
      • 1249. Minimum Remove to Make Valid Parentheses
      • *281. Zigzag Iterator
      • *1429. First Unique Number
      • *346. Moving Average from Data Stream
    • 优先队列/堆
      • 692. Top K Frequent Words
      • 347. Top K Frequent Elements
      • 973. K Closest Points
      • 23. Merge K Sorted Lists
      • 264. Ugly Number II
      • 378. Kth Smallest Element in a Sorted Matrix
      • 295. Find Median from Data Stream
      • 767. Reorganize String
      • 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
      • 895. Maximum Frequency Stack
      • 1705. Maximum Number of Eaten Apples
      • *1086. High Five
    • 深度优先DFS
      • 二叉树
      • 543. Diameter of Binary Tree
      • 101. Symmetric Tree
      • 124. Binary Tree Maximum Path Sum
      • 226. Invert Binary Tree
      • 104. Maximum Depth of Binary Tree
      • 951. Flip Equivalent Binary Trees
      • 236. Lowest Common Ancestor of a Binary Tree
      • 987. Vertical Order Traversal of a Binary Tree
      • 572. Subtree of Another Tree
      • 863. All Nodes Distance K in Binary Tree
      • 1110. Delete Nodes And Return Forest
      • 230. Kth Smallest element in a BST
      • 98. Validate Binary Search Tree
      • 235. Lowest Common Ancestor of a Binary Search Tree
      • 669. Trim a Binary Search Tree
      • 700. Search in a Binary Search Tree
      • 108. Convert Sorted Array to Binary Search Tree
      • 450. Delete Node in a BST
      • 938. Range Sum of BST
      • *270. Closest Binary Search Tree Value
      • *333. Largest BST Subtree
      • *285. Inorder Successor in BST
      • *1485. Clone Binary Tree With Random Pointer
      • 回溯
      • 39. Combination Sum
      • 78. Subsets
      • 46. Permutation
      • 77. Combinations
      • 17. Letter Combinations of a Phone Number
      • 51. N-Queens
      • 93. Restore IP Addresses
      • 22. Generate Parentheses
      • 856. Score of Parentheses
      • 301. Remove Invalid Parentheses
      • 37. Sodoku Solver
      • 图DFS
      • 126. Word Ladder II
      • 212. Word Search II
      • 79. Word Search
      • 399. Evaluate Division
      • 1376. Time Needed to Inform All Employees
      • 131. Palindrome Partitioning
      • 491. Non-decreasing Subsequences
      • 698. Partition to K Equal Sum Subsets
      • 526. Beautiful Arrangement
      • 139. Word Break
      • 377. Combination Sum IV
      • 472. Concatenated Words
      • 403. Frog Jump
      • 329. Longest Increasing Path in a Matrix
      • 797. All Paths From Source to Target
      • 695. Max Area of Island
      • 341. Flatten Nested List Iterator
      • 394. Decode String
      • *291. Word Pattern II
      • *694. Number of Distinct Islands
      • *1274. Number of Ships in a Rectangle
      • *1087. Brace Expansion
    • 广度优先BFS
      • 102. Binary Tree Level Order Traversal
      • 103. Binary Tree Zigzag Level Order Traversal
      • 297. Serialize and Deserialize Binary Tree
      • 310. Minimum Height Trees
      • 127. Word Ladder
      • 934. Shortest Bridge
      • 200. Number of Islands
      • 133. Clone Graph
      • 130. Surrounded Regions
      • 752. Open the Lock
      • 815. Bus Routes
      • 1091. Shortest Path in Binary Matrix
      • 542. 01 Matrix
      • 1293. Shortest Path in a Grid with Obstacles Elimination
      • 417. Pacific Atlantic Water Flow
      • 207. Course Schedule
      • 210. Course Schedule II
      • 787. Cheapest Flights Within K Stops
      • 444. Sequence Reconstruction
      • 994. Rotting Oranges
      • 785. Is Graph Bipartite?
      • *366. Find Leaves of Binary Tree
      • *314. Binary Tree Vertical Order Traversal
      • *269. Alien Dictionary
      • *323. Connected Component in Undirected Graph
      • *490. The Maze
    • 动态规划
      • 70. Climbing Stairs
      • 72. Edit Distance
      • 377. Combination Sum IV
      • 1335. Minimum Difficulty of a Job Schedule
      • 97. Interleaving String
      • 472. Concatenated Words
      • 403. Frog Jump
      • 674. Longest Continuous Increasing Subsequence
      • 62. Unique Paths
      • 64. Minimum Path Sum
      • 368. Largest Divisible Subset
      • 300. Longest Increasing Subsequence
      • 354. Russian Doll Envelopes
      • 121. Best Time to Buy and Sell Stock
      • 132. Palindrome Partitioning II
      • 312. Burst Balloons
      • 1143. Longest Common Subsequence
      • 718. Maximum Length of Repeated Subarray
      • 174. Dungeon Game
      • 115. Distinct Subsequences
      • 91. Decode Ways
      • 639. Decode Ways II
      • 712. Minimum ASCII Delete Sum for Two Strings
      • 221. Maximal Square
      • 1277. Count Square Submatrices with All Ones
      • 198. House Robber
      • 213. House Robber II
      • 1235. Maximum Profit in Job Scheduling
      • 740. Delete and Earn
      • 87. Scramble String
      • 1140. Stone Game II
      • 322. Coin Change
      • 518. Coin Change II
      • 1048. Longest String Chain
      • 44. Wildcard Matching
      • 10. Regular Expression Matching
      • 32. Longest Valid Parentheses
      • 1043. Partition Array for Maximum Sum
      • *256. Paint House
      • 926. Flip String to Monotone Increasing
      • *1062. Longest Repeating Substring
      • *1216. Valid Palindrome III
    • 贪心
      • 56. Merge Intervals
      • 621. Task Scheduler
      • 135. Candy
      • 376. Wiggle Subsequence
      • 55. Jump Game
      • 134. Gas Station
      • 1005. Maximize Sum Of Array After K Negations
      • 406. Queue Reconstruction by Height
      • 452. Minimum Number of Arrows to Burst Balloons
      • 738. Monotone Increasing Digits
    • 单调栈
      • 739. Daily Temperatures
      • 503. Next Greater Element II
      • 901. Online Stock Span
      • 85. Maximum Rectangle
      • 84. Largest Rectangle in Histogram
      • 907. Sum of Subarray Minimums
      • 239. Sliding Window Maximum
    • 前缀和
      • 53. Maximum Subarray
      • 523. Continuous Subarray Sum
      • 304. Range Sum Query 2D - Immutable
      • 1423. Maximum Points You Can Obtain from Cards
      • 1031. Maximum Sum of Two Non-Overlapping Subarrays
    • 并查集
      • 684. Redundant Connection
      • 721. Accounts Merge
      • 547. Number of Provinces
      • 737. Sentence Similarity II
      • *305. Number of Islands II
    • 字典树trie
      • 208. Implement Trie
      • 211. Design Add and Search Words Data Structure
      • 1268. Search Suggestions System
      • *1166. Design File System
      • *642. Design Search Autocomplete System
    • 扫描线sweep line
      • 253. Meeting Room II
      • 1094. Car Pooling
      • 218. The Skyline Problem
      • *759. Employee Free Time
    • tree map
      • 729. My Calendar I
      • 981. Time Based Key-Value Store
      • 846. Hand of Straights
      • 480. Sliding Window Median
      • 318. Count of Smaller Numbers After Self
    • 数学类
      • 50. Pow(x, n)
      • *311. Sparse Matrix Multiplication
      • 382. Linked List Random Node
      • 398. Random Pick Index
      • 29. Divide Two Integers
    • 设计类
      • 1603. Design Parking System
      • 355. Design Twitter
      • 1396. Design Underground System
      • *359. Logger Rate Limiter
      • *353. Design Snake Game
      • *379. Design Phone Directory
      • *588. Design In-Memory File System
      • *1244. Design A Leaderboard
    • SQL
  • 机器学习
    • 数学基础
    • 评价指标
    • 线性回归
    • 逻辑回归
    • 树模型
    • 深度学习
    • 支持向量机
    • KNN
    • 无监督学习
    • k-means
    • 强化学习 RL
    • 自然语言处理 NLP
    • 大语言模型 LLM
    • 机器视觉 CV
    • 多模态 MM
    • 分布式机器学习
    • 推荐系统
    • 异常检测与风控
    • 模型解释性
    • 多任务学习
    • MLops
    • 特征工程
    • 在线学习
    • 硬件 cuda/triton
    • 产品case分析
    • 项目deep dive
    • 机器学习代码汇总
  • 系统设计
    • 面向对象设计
      • 电梯设计
      • 停车场设计
      • Unix文件系统设计
    • 系统设计
      • 设计社交网站Twitter
      • 设计视频网站Youtube
      • 短网址系统
      • 爬虫系统
      • 任务调度系统
      • 日志系统
      • 分布式缓存
      • 广告点击聚合系统
      • webhook
    • 机器学习系统设计
      • 推荐系统
      • 搜索引擎
      • Youtube视频推荐
      • Twitter推荐
      • 广告点击预测
      • 新闻推送推荐
      • POI推荐
      • Youtube视频搜索
      • 有害内容检测
      • 大模型RAG
      • 大模型Agent
      • 信贷风控
      • 朋友推荐
      • 去重复性/版权检测
      • 情感分析
      • 目标检测
      • 问答系统
      • 知识图谱问答
  • 行为面试
    • 领导力法则
    • 问答举例
  • 案例分享
    • 准备工作
    • 面试小抄
    • 面试之后
Powered by GitBook
On this page
  • 1. offline 刷题策略
  • 2. online 面试解题过程
  • 3. 公司特点
  • 4. 刷题
  • 4.1 参考刷题列表
  • 4.2 Python
  • 4.3 Java
  • 4.4 CPP
  • 4.5 CS基础与DSA

数据结构与算法

LeetCode在面试时常被认为是衡量CS水平的重要指标。精刷大于泛刷,熟练度大于题量。因此,尽量提高熟练度,并踩对得分点和signal

1. offline 刷题策略

大厂面试相对规范和模版化,按四个维度评分(communication, problem solving, coding, verification)。想到某个方向可以加多少分,写出一个实现可以加多少分,有bug扣多少分,答错复杂度扣多少分等。

  • 1、如果零基础,先掌握常见的数据结构和算法,包括常见类型的解题模版

  • 2、按tag刷题,熟悉模版的基础上,不断强化练习,并尝试多种解法实现

  • 3、按热度刷题,参加周赛,刷题量达到满意要求。练习边说边写,结合题目交流、复杂度分析、头脑测试

  • 4、面试前,针对面试公司tag和最新面经重点练习

2. online 面试解题过程

面试过程中,重要的是: 快速给出bug free代码,有良好的沟通和思路介绍。做题前的寒暄、项目介绍不必随意展开(1~2min),留够做题时间。

  • (1) 面试官出题

  • (2) 面试者读题并 clarification question

    • 不明白的地方一定问清楚,而不是随意假设或略过,有面试官会故意遗漏内容。可以通过列举test case,来确保理解问题并涵盖所有情况。

    • 功能需求确定好之后,确认输入/输出的类型和边界(input/output type)

      • 输入数字全是正数或者全是负数, null or empty

      • 输入string是不是都是English letters (A-Z),有没有特殊符号

      • 输入是否有重复样本,输出是否允许重复

      • standard input, empty input, malformed input, long input, null input, other edge input

      • 能不能改input,immutable or not (1D/2D array比较常见)

      • 特殊情况输出返回什么

    • 确认时间空间复杂度要求

      • 要不要in place

      • 有没有内存限制

  • (3) 面试官回答问题保证面试者正确理解题目

  • (4) 面试者思考怎么做,先和面试官讲明白思路,并得到认同。思路未得到认同前不要急于写代码

    • Whenever coming across a solution, talk it out and discuss it with the interviewer

    • 第一性原则出发,从逻辑/模拟角度思考如何解决问题。没有思路时,想想更简单、数量更少时

    • 介绍思路时,可以询问: Am I in the right direction?

    • 2分钟内还没有思路,可以主动和面试官要提示(hint)

    • 想不到最优的方法也可以先跑一个可行解再优化,不确定是否最优可询问: Could we have a better solution?

    • 熟悉的题目也可以先说一下穷举/暴力做法,通过分析重复操作或引入高效的数据结构,从而引入最优解

  • (5) 确认好思路后写代码实现算法

    • 用什么数据结构,什么算法。讲思路的时候,说清楚为什么选择这个数据结构

    • During writing the code, whenever coming across edge cases, discuss with the interviewer about how to handle the edge case

  • (6) 测试验证代码正确性

    • I just finished my coding, now I need to run several test cases to see if I covered all the edge cases and if there is any bugs I missed

    • 注意可能需要自己写tests,给出corner case test

    • dry run

      • 选择能够覆盖各种边界情况和不同输入的例子(test cases)

      • 列出你算法的所有变量的初始状态

      • 逐步执行算法,逐步更新这些变量的值

      • 每个关键点,检查你的变量是否符合预期

    • 空,一个数,两个一样的数(重复)

  • (7) 讲述自己算法的时间、空间复杂度

  • (8) 面试官确认没问题后准备follow up题目或者下一道题目

3. 公司特点

Google

  • LeetCode: 非tag原题多,hard多(DP, DFS, Backtracking, Trie),极其看重解决问题的思考过程,自己写test case。面经题仍有帮助

Meta

  • LeetCode: tag原题,35分钟两道题, 看重bug free和最优解

  • ML system design: recommendation, video search, harmful content detection

Microsoft

  • LeetCode: 基础算法、数据结构的快速实现

Amazon

  • LeetCode: Grind75, 15分钟一道题,原题,Graph

  • BQ: 每一轮BQ占30分钟+, 2个LP

Tiktok

  • LeetCode: 不按tag

  • ML: 可能有国内面试习惯,深挖简历项目,MLE讲清领域来龙去脉

4. 刷题

4.1 参考刷题列表

重点: 刷透高频题,不要假设哪种类别肯定不会考

4.2 Python

  • 垃圾回收机制gc

  • 全局锁GIL

    • 因为引用计数所以需要全局锁,因为全局锁所以影响多线程

  • python里的list和dict是怎么实现的

  • python里的with怎么实现的

  • 数据结构

    • mutable(可变): list, dict, set

    • immutable(不可变): int, float, str, tuple

4.3 Java

4.4 CPP

4.5 CS基础与DSA

  • MIT 6.824 分布式系统

  • MIT 6.s081 操作系统

  • CMU 15445 数据库

Previous面试指南Next列表

Last updated 11 days ago

OA真题
大厂的面试的差异和重点
Googleyness & Leadership Interview Questions
blind75
代码随想录
LeetCode 101:和你一起你轻松刷题
Neetcode300
灵茶山艾府
Leetcode面试高频题分类刷题总结
花花酱 LeetCode Problem List 题目列表
时间复杂度-Abdul Bari's Algorithm Playlist
Data Structures Easy to Advanced Course - Full Tutorial from a Google Engineer and ACM ICPC World Finalist
异步与协程
什么是协程?
也来谈谈协程 - invalid s的文章 - 知乎
进程与线程
java guide
Containers library
C++ 并发编程
Introduction to Computer Science - Harvard CS50x
Structure and Interpretation of Computer Programs - UC Berkeley CS 61A
How to Design Programs
深入理解计算机系统 - CSAPP
The Art of Computer Programming - TAOCP
代码大全
UNIX 编程艺术
重构:改善既有代码的设计
算法 - Stanford
Algorithms
算法导论 - CLRS