GitLab Coding Interview Questions
25 GitLab coding interview problems with full optimal solutions — 15 easy, 7 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 GitLab interviewer values, and a FAQ section.
Showing 7 problems of 25
- #16mediumfoundational
16. Course Schedule
Decide whether a set of courses with prerequisite pairs can be completed — i.e. whether the dependency graph is acyclic.
- #17mediumfoundational
17. Course Schedule II
Return any valid course ordering that satisfies the prerequisite dependencies, or an empty list if the graph has a cycle.
- #18mediumfoundational
18. LRU Cache
Implement a cache with O(1) get and put that evicts the least recently used entry when full.
- #19mediumfoundational
19. Number of Islands
Count connected components of '1' cells in a 2D grid where neighbors are 4-directional.
- #20mediumfoundational
20. Kth Largest Element in an Array
Return the kth largest element of an unsorted array, ideally without fully sorting it.
- #21mediumfoundational
21. Lowest Common Ancestor of a Binary Tree
Find the deepest node that has both p and q as descendants in a binary tree.
- #22mediumfoundational
22. Top K Frequent Words
Return the k most frequent words, breaking frequency ties alphabetically.