30 Most Frequent Algorithm Questions in Big Tech Interviews: Categorized Collection

Interview ExperienceAuthor: BeautyResume Team

Categorized collection of 30 most frequent algorithm questions in big tech interviews. Covers arrays, linked lists, trees, dynamic programming, graphs with key points, difficulty, and solution approaches. Latest 2026 compilation.

Why I Compiled These 30 Questions

Last year I went on an intensive interview spree, hitting up ByteDance, Alibaba, Tencent, Meituan, JD, and several other big tech companies. The algorithm round showed up at virtually every single one. After it was all over, I looked back and realized the overlap in frequently asked questions was staggering — different companies were cycling through the same categories over and over. So I spent a weekend categorizing every high-frequency algorithm question I encountered or confirmed with friends, ending up with 30 problems I hope will help anyone currently preparing.

I've organized them into six major categories: Arrays/Strings, Linked Lists, Trees, Dynamic Programming, Graph Theory, and Design. Each problem includes its LeetCode number, what it tests, difficulty level, and key solution insights. These are genuine interview problems I faced — not random picks from a problem bank.

1. Arrays/Strings (6 Problems)

1. Two Sum (LeetCode #1)

Difficulty: Easy | Tests: Hash Map Usage

This is the universal interview opener. Both ByteDance and Meituan led with this one. The approach is straightforward: use a hash map to store previously visited elements and find the complement in a single pass — O(n) time. Interviewers typically follow up with "what if the array is sorted?" which opens the door to the two-pointer approach.

Key insight: Don't underestimate easy problems. Interviewers use this as a springboard for variants like 3Sum, 4Sum, or returning all valid pairs.

2. 3Sum (LeetCode #15)

Difficulty: Medium | Tests: Sorting + Two Pointers, Deduplication

Alibaba asked this one. Sort the array, fix one number, then use two pointers on the remaining portion to find pairs summing to the target. The critical challenge is deduplication — interviewers pay close attention to whether you handle duplicate triplets. My first attempt didn't handle it, and the interviewer pointed it out. Slightly embarrassing.

Key insight: Sorting O(nlogn), two-pointer traversal O(n²). Pay attention to the logic for skipping duplicate elements.

3. Longest Substring Without Repeating Characters (LeetCode #3)

Difficulty: Medium | Tests: Sliding Window

Tencent's second round. Classic sliding window: maintain a window with no repeating characters using two pointers — expand right, shrink left. The follow-up was "if the character set is only lowercase letters, can you optimize?" The answer: use an array instead of a hash map for tracking character positions.

Key insight: Sliding window is the core pattern for array/string problems. Master it thoroughly.

4. Merge Intervals (LeetCode #56)

Difficulty: Medium | Tests: Sorting + Greedy

JD's first round. Sort by start point, then check if the current interval overlaps with the last one in the result. The interviewer asked me to write the comparator by hand — I used a lambda and got a nod. Not a hard problem, but edge cases are tricky — whether equal endpoints count as overlapping is something you must clarify with the interviewer.

5. Sliding Window Maximum (LeetCode #239)

Difficulty: Hard | Tests: Monotonic Deque

ByteDance's second round. I only knew the brute force approach initially, but the interviewer guided me toward the monotonic deque. Maintain a decreasing deque where the front is always the current window's maximum. The tricky part is understanding "why expired elements pop from the front while smaller elements pop from the back."

Key insight: Monotonic deque is a high-frequency topic. Practice it alongside "Largest Rectangle in Histogram."

6. Rotate Array (LeetCode #189)

Difficulty: Medium | Tests: Array Reversal Technique

Meituan's first round. The most elegant solution uses three reversals: reverse the entire array, reverse the first k elements, then reverse the remaining n-k elements. The interviewer asked for O(1) space, which the three-reversal approach satisfies perfectly. There's also a cyclic replacement method, but it's error-prone — not recommended in interviews.

2. Linked Lists (4 Problems)

7. Reverse Linked List (LeetCode #206)

Difficulty: Easy | Tests: Pointer Manipulation

I've been asked this at least five times — almost every company asks it. You need to know both iterative and recursive approaches. Interviewers frequently follow up with "Reverse Linked List II" (reverse a specific range), so prepare for that too. The iterative approach uses three pointers (prev, curr, next); the recursive approach requires understanding pointer reconnection during backtracking.

8. Merge Two Sorted Lists (LeetCode #21)

Difficulty: Easy | Tests: Merge Sort Thinking

Alibaba's first round. Use a dummy head to simplify the logic, with two pointers traversing both lists, always taking the smaller node. The follow-up was "merge K sorted lists," which requires a min-heap optimization — O(NlogK) time complexity.

9. Linked List Cycle (LeetCode #141/142)

Difficulty: Easy/Medium | Tests: Fast & Slow Pointers

Tencent asked about detecting a cycle (#141); Meituan followed up with finding the cycle's entry point (#142). The fast-slow pointer is the standard approach. The interviewer asked me to prove "why fast and slow pointers will always meet in the cycle" — this requires a mathematical argument: with the fast pointer moving 2 steps and the slow pointer 1 step, the relative speed in the cycle is 1, so they must eventually meet.

Key insight: For #142, after they meet, move one pointer back to the start, then advance both at the same speed — the next meeting point is the cycle's entry.

10. Reverse Nodes in k-Group (LeetCode #25)

Difficulty: Hard | Tests: Comprehensive Linked List Operations

ByteDance's first round. This is the advanced version of reversing a linked list. Core idea: count k nodes, reverse that group, then recursively process the rest. The difficulty lies in pointer reconnection — the head and tail of the reversed group must properly link back to the original list. My first attempt had the tail pointer wrong, and I spent a while debugging.

3. Trees (5 Problems)

11. Binary Tree Level Order Traversal (LeetCode #102)

Difficulty: Medium | Tests: BFS

Both Alibaba and Tencent asked this. Use a queue for BFS — the key is grouping output by level. Interviewers check whether you use a size variable to control each level's traversal range rather than using null as a separator (the former is more standard). Variants include zigzag level order traversal (#103) and right side view (#199) — practice them together.

12. Maximum Depth of Binary Tree (LeetCode #104)

Difficulty: Easy | Tests: Recursion/DFS

A warm-up problem — one line of recursive code. Interviewers rarely ask this in isolation; it's usually a setup for follow-ups like "determine if a tree is balanced" or "minimum depth." Master both recursive and iterative approaches.

13. Path Sum III (LeetCode #437)

Difficulty: Medium | Tests: Prefix Sum + Recursion

Meituan's second round. Find all paths where the sum equals the target value. The key optimization is using a prefix sum — reducing from O(n²) to O(n). Similar to the Two Sum approach, use a hash map to record prefix sum frequencies. The interviewer mentioned that few candidates solve this one — it's a differentiator.

14. Lowest Common Ancestor of a Binary Tree (LeetCode #236)

Difficulty: Medium | Tests: Recursive Post-order Traversal

Both ByteDance and Alibaba asked this. A classic application of post-order traversal: if the left and right subtrees each find p and q respectively, the current node is the LCA. The follow-up was "what if it's a BST?" (#235) — the BST version can leverage ordering for pruning, making it simpler. The recursive logic must be crystal clear — explain as you write.

15. Validate Binary Search Tree (LeetCode #98)

Difficulty: Medium | Tests: In-order Traversal / Recursive Validation

JD's second round. Two approaches: in-order traversal checking for strictly increasing sequence, or recursive validation passing down min/max bounds. Interviewers prefer the latter since it requires no extra space. I initially used in-order traversal; the interviewer asked me to rewrite it with the recursive bounds approach, and seemed satisfied after the revision.

4. Dynamic Programming (6 Problems)

16. Climbing Stairs (LeetCode #70)

Difficulty: Easy | Tests: DP Fundamentals

The classic DP entry problem. dp[i] = dp[i-1] + dp[i-2] — essentially Fibonacci. Interviewers use this as a starting point, then escalate to variants like "climb 1 to m steps at a time" or "minimum cost climbing stairs." Space can be optimized to O(1) by keeping only the last two states.

17. Longest Increasing Subsequence (LeetCode #300)

Difficulty: Medium | Tests: DP + Binary Search

Tencent's second round. Standard DP is O(n²), using dp[i] for the length of the LIS ending at nums[i]. The interviewer asked about the O(nlogn) approach — maintain a sorted tails array and update using binary search. This optimization is important; it also appears in Russian Doll Envelopes (#354).

18. Edit Distance (LeetCode #72)

Difficulty: Hard | Tests: 2D DP

Alibaba's second round. dp[i][j] represents the minimum operations to transform the first i characters of word1 into the first j characters of word2. State transitions consider insert, delete, and replace — take the minimum. The tricky part is initialization: dp[i][0] = i and dp[0][j] = j represent the cost of converting to/from an empty string. I recommend drawing a DP table during the interview.

19. Coin Change (LeetCode #322)

Difficulty: Medium | Tests: Unbounded Knapsack

Meituan's first round. dp[i] represents the minimum coins needed for amount i, trying each coin denomination. This is a variant of the unbounded knapsack — each coin can be used infinitely. The follow-up asked for "all possible combinations," which requires backtracking. Note: initialize dp[0] = 0, everything else to infinity.

20. 0-1 Knapsack Problem

Difficulty: Medium | Tests: Classic DP Model

ByteDance's first round. Given item weights and values, find maximum value within a capacity constraint. dp[i][j] represents the maximum value using the first i items with capacity j — each item is either taken or not. When optimizing to 1D, iterate in reverse to avoid duplicate selection. The interviewer also asked about Partition Equal Subset Sum (#416), which is essentially 0-1 knapsack.

21. Longest Common Subsequence (LeetCode #1143)

Difficulty: Medium | Tests: 2D DP

Tencent's first round. dp[i][j] represents the LCS length of the first i characters of text1 and first j characters of text2. If characters match, dp[i][j] = dp[i-1][j-1] + 1; otherwise, take the max of the cell above and to the left. The interviewer asked me to reconstruct the actual LCS, which requires backtracking through the DP table. This problem's DP structure is very similar to Edit Distance — study them together.

5. Graph Theory (4 Problems)

22. Number of Islands (LeetCode #200)

Difficulty: Medium | Tests: DFS/BFS/Union-Find

Both Alibaba and ByteDance asked this. Traverse the grid; when you encounter '1', start a DFS/BFS marking all connected '1's as '0' and increment the count. The follow-up asked about "maximum island area." Union-Find also works but requires more code — DFS is the safest bet in interviews.

23. Course Schedule (LeetCode #207)

Difficulty: Medium | Tests: Topological Sort / Cycle Detection

Meituan's second round. Essentially detecting whether a directed graph has a cycle. Use BFS + in-degree array for topological sort, or DFS for cycle detection. The follow-up was "output the course order" (#210) — the full topological sort. Building the graph correctly is where most mistakes happen — make sure the adjacency list and in-degree array are properly aligned.

24. Shortest Path (Dijkstra's Algorithm)

Difficulty: Medium | Tests: Greedy + Priority Queue

Tencent's third round asked Network Delay Time (LeetCode #743), which is essentially Dijkstra. With a priority queue, the time complexity is O(ElogV). The interviewer asked me to implement a heap from scratch — I wrote a simplified priority queue. Note: Dijkstra only works for non-negative weight graphs; for negative weights, use Bellman-Ford.

25. Topological Sort Applications

Difficulty: Medium | Tests: BFS Topological Sort

ByteDance's second round asked Alien Dictionary (LeetCode #269) — deducing letter order from word order, which is still topological sort. The difficulty lies in building the graph — extracting partial order relationships from adjacent words. I got the graph construction wrong during the interview; the interviewer gave me a hint before I corrected it. This problem definitely trips people up at the graph-building stage.

6. Design Problems (5 Problems)

26. LRU Cache (LeetCode #146)

Difficulty: Medium | Tests: Hash Map + Doubly Linked List

The most frequently asked design problem at big tech companies — ByteDance, Alibaba, and Tencent all asked it. The core data structure is a hash map + doubly linked list: O(1) lookup with the hash map, O(1) order adjustment with the linked list. On get, move the node to the head; on put, if over capacity, evict the tail. Interviewers will follow up with thread safety, distributed caching, and other extensions.

27. Min Stack (LeetCode #155)

Difficulty: Medium | Tests: Auxiliary Stack

JD's first round. Two stacks: one for data, one tracking the current minimum. On push, the auxiliary stack pushes the current minimum; on pop, both stacks pop together. The follow-up was "can you do it with just one stack?" — you can use a difference-based approach storing the difference between current value and minimum, but readability suffers. Not recommended in interviews.

28. Implement Queue using Stacks (LeetCode #232)

Difficulty: Easy | Tests: Two-Stack Simulation

Meituan's first round. Two stacks: an input stack and an output stack. Push goes to the input stack; on pop, if the output stack is empty, dump everything from the input stack. The interviewer asked about amortized time complexity — each element is moved at most twice, so amortized O(1). The variant is implementing a stack using queues (#225).

29. Implement Trie (Prefix Tree) (LeetCode #208)

Difficulty: Medium | Tests: Tree Data Structure Design

Alibaba's second round. Each node contains 26 child pointers and an isEnd flag. Insert character by character; search character by character. The follow-up was "implement autocomplete" — do a DFS from the prefix node to output all words starting with that prefix. This problem has significant code volume — I recommend explaining your approach before writing code.

30. Skip List

Difficulty: Hard | Tests: Probabilistic Data Structure

ByteDance's third round. Skip lists are one of the underlying implementations for Redis sorted sets. The interviewer asked me to "hand-write a skip list insert operation." The core idea is achieving O(logn) search through multi-level indexing, with each node having a probability p of being promoted to the next level. I'd only understood the theory before and had never implemented one — I stumbled through the implementation, and the interviewer eventually said "the approach is correct, that's what matters."

Key insight: Skip lists aren't on LeetCode, but big tech companies do ask about them, especially for Redis-related positions. Understand the principles and be able to at least diagram the insertion and deletion processes.

Quick Reference Table

Here's a quick-scan table of all 30 problems to help you identify weak areas:

Arrays/Strings: Two Sum (#1, Easy), 3Sum (#15, Medium), Longest Substring (#3, Medium), Merge Intervals (#56, Medium), Sliding Window Maximum (#239, Hard), Rotate Array (#189, Medium)

Linked Lists: Reverse Linked List (#206, Easy), Merge Sorted Lists (#21, Easy), Linked List Cycle (#141/142, Easy/Medium), Reverse k-Group (#25, Hard)

Trees: Level Order Traversal (#102, Medium), Max Depth (#104, Easy), Path Sum III (#437, Medium), LCA (#236, Medium), Validate BST (#98, Medium)

Dynamic Programming: Climbing Stairs (#70, Easy), LIS (#300, Medium), Edit Distance (#72, Hard), Coin Change (#322, Medium), 0-1 Knapsack (Medium), LCS (#1143, Medium)

Graph Theory: Number of Islands (#200, Medium), Course Schedule (#207, Medium), Shortest Path (#743, Medium), Topological Sort (#269, Medium)

Design: LRU Cache (#146, Medium), Min Stack (#155, Medium), Queue via Stacks (#232, Easy), Trie (#208, Medium), Skip List (Hard)

Key Takeaways and Advice

1. Be strategic — don't chase quantity blindly. Early on I ground through 200+ problems, but many were repetitive within the same type. Switching to category-based practice with 3-5 classic problems per type worked much better. Truly mastering 30 high-frequency problems beats randomly doing 100.

2. Explain your approach before writing code. I learned this the hard way — at ByteDance's second round, I started coding immediately, realized halfway through that my approach was flawed, and ran out of time rewriting. Now I always spend 2-3 minutes confirming my approach with the interviewer first.

3. Take variants and follow-ups seriously. Interviewers rarely ask just the original problem. Two Sum leads to 3Sum, Reverse Linked List leads to range reversal, Level Order leads to zigzag traversal. Prepare common variants alongside each problem.

4. Don't skip easy problems. Many people think easy problems don't need practice, but they're often the opening question — stumbling on them creates a bad first impression. And easy problems can have surprisingly tricky follow-ups.

5. Proactively analyze time and space complexity. After writing your code, don't wait for the interviewer to ask — volunteer the complexity analysis and whether optimization is possible. It's a clear differentiator.

FAQ

Q: Are 30 problems enough? How many should I do for big tech interviews?

A: 30 high-frequency problems form the core, but I recommend doing 80-100 total to cover common patterns. Quality over quantity — understand the principles rather than memorizing answers.

Q: What order should I follow?

A: Arrays/Strings → Linked Lists → Trees → Dynamic Programming → Graph Theory → Design. Go from easy to hard within each category — build confidence with easy problems first.

Q: What if I can't solve the algorithm problem during an interview?

A: Never sit in silence. Start with the brute force approach you can think of, then discuss optimization directions with the interviewer. They'll usually give hints — following those hints to the final solution is perfectly acceptable.

Q: Should I do LeetCode weekly contests?

A: If you have time, they're great for practicing timed problem-solving. But contest problems lean toward competitive programming style, which differs from interview style — prioritize high-frequency problems.

Q: I can never figure out DP state transition equations. What should I do?

A: This is completely normal. Start from the simplest Climbing Stairs and gradually work up to knapsack and subsequence problems. Draw state transition tables for every DP problem — understanding what the dp array means and how transitions work is more effective than memorizing templates.

#Algorithm Interview#Big Tech Interview#LeetCode#面试 Real Questions