Quora Coding Interview Questions
26 Quora coding interview problems with full optimal solutions — 17 easy, 7 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Quora interviewer values, and a FAQ section.
- #14easyfoundational
14. Clone Graph
Deep-copy a connected undirected graph — Quora uses this pattern to test how you replicate user-question relationship networks without corrupting shared references between nodes.
- #15easyfoundational
15. Number of Islands
Count connected components in a binary grid — at Quora this translates directly to identifying isolated topic clusters in the user-question graph, a real signal in their content-quality pipeline.
- #16easyfoundational
16. Valid Anagram
Determine whether two strings are anagrams — Quora uses this frequency-counting pattern to detect near-duplicate questions where word order differs but vocabulary is identical.
- #17easyfoundational
17. First Unique Character in a String
Find the first non-repeating character in a string — Quora applies this frequency-then-scan pattern to surface the first truly distinctive keyword in a question title for their search-ranking pipeline.
- #18mediumfoundational
18. Top K Frequent Elements
Return the k most frequent elements in an array — Quora's question-ranking system runs this exact top-K pattern to surface the most-viewed topics for a given user cohort in real time.
- #19mediumfoundational
19. Course Schedule
Detect a cycle in a directed graph of prerequisites — Quora uses this exact topological-sort check to validate that answer-dependency graphs in their knowledge graph have no circular references.
- #20mediumfoundational
20. Word Search
Find a word hidden in a 2-D character grid — Quora applies this backtracking-DFS pattern to their entity-extraction engine when scanning structured text fields for keyword sequences.
- #21mediumfoundational
21. LRU Cache
Design a cache that evicts the least-recently-used entry — Quora's answer-caching layer runs this exact doubly-linked-list + hash-map pattern to keep hot Q&A pairs in memory without blowing the cache budget.
- #22mediumfoundational
22. Find K Pairs with Smallest Sums
Return the k pairs from two sorted arrays with the smallest sums — Quora uses this min-heap merge pattern to blend two ranked recommendation lists into a single top-K feed without sorting the full cross-product.
- #23mediumfoundational
23. Longest Substring Without Repeating Characters
Find the longest contiguous substring with all unique characters — Quora's query-normalisation step applies this sliding-window pattern to extract the longest non-repetitive token sequence from user search strings.
- #24mediumfoundational
24. Implement Trie (Prefix Tree)
Build a prefix tree that supports insert, search, and startsWith — Quora's autocomplete engine is a production trie; they ask you to implement one from scratch to verify you understand the branching mechanics under the hood.
- #25hardfoundational
25. Word Ladder
Find the shortest transformation sequence between two words — Quora uses this BFS-on-word-graph pattern to power their 'related topics' traversal, finding the minimum conceptual hops between two knowledge domains.
- #26hardfoundational
26. Trapping Rain Water
Calculate how much water collects between elevation bars — Quora uses this two-pointer constraint pattern in their feed-ranking logic to model how much engagement 'pools' between dominant signals in a user's interest profile.
- #1easyfoundational
1. Two Sum
Given an array of integers and a target, return indices of two numbers that add up to the target.
- #2easyfoundational
2. Valid Parentheses
Determine if a string of brackets is balanced and properly nested.
- #3easyfoundational
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list.
- #4easyfoundational
4. Remove Duplicates from Sorted Array
Remove duplicates from a sorted array in place and return the new length.
- #5easyfoundational
5. Remove Element
Remove all occurrences of a value from an array in place and return the new length.
- #6easyfoundational
6. Search Insert Position
Return the index where a target should be inserted to keep a sorted array sorted.
- #7easyfoundational
7. Plus One
Increment a large integer represented as an array of digits.
- #8easyfoundational
8. Merge Sorted Array
Merge two sorted arrays in place where the first has extra slots at the end.
- #9easyfoundational
9. Binary Tree Inorder Traversal
Return the inorder traversal of a binary tree's node values.
- #10easyfoundational
10. Same Tree
Check if two binary trees are structurally identical with equal values.
- #11easyfoundational
11. Symmetric Tree
Check if a binary tree is a mirror image of itself.
- #12easyfoundational
12. Maximum Depth of Binary Tree
Return the maximum depth (height) of a binary tree.
- #13easyfoundational
13. Balanced Binary Tree
Check whether a binary tree is height-balanced.