Baidu Coding Interview Questions
25 Baidu coding interview problems with full optimal solutions — 11 easy, 11 medium, 3 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Baidu interviewer values, and a FAQ section.
Showing 3 problems of 25
- #23hardfoundational
23. Sliding Window Maximum
For each window of size k in an array, return the maximum value in linear total time.
- #24hardfoundational
24. Find Median from Data Stream
Design a class that ingests integers one at a time and returns the median of all values seen so far in O(log n).
- #25hardfoundational
25. LFU Cache
Design a fixed-capacity cache that evicts the least-frequently-used key (ties broken by least-recent) in O(1) per op.