Gusto Coding Interview Questions
25 Gusto coding interview problems with full optimal solutions — 8 easy, 12 medium, 5 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Gusto interviewer values, and a FAQ section.
Showing 16 problems of 25
- #4hardrarely asked
4. Median of Two Sorted Arrays
Find the median of two sorted arrays in O(log(m+n)). Gusto asks this for senior roles to test binary search reasoning under pressure — they want the binary search on partitions approach, and they watch whether you can maintain the invariant clearly without devolving into case chaos.
- #21easycommonly asked
21. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list. Gusto uses this to test linked-list pointer discipline and to see if you reach for a dummy head node — the single trick that eliminates all the edge-case noise.
- #23hardcommonly asked
23. Merge K Sorted Lists
Merge k sorted linked lists into one. Gusto asks this as the natural escalation from Merge Two Sorted Lists — they want to see the divide-and-conquer approach or a min-heap, and they care that you recognise the O(Nk) naive solution is unacceptable.
- #41hardrarely asked
41. First Missing Positive
Find the smallest missing positive integer in O(n) time and O(1) extra space. Gusto asks this to test whether candidates can use the array itself as a hash map — the insight that the answer must lie in [1, n+1] is what unlocks the in-place solution.
- #42hardcommonly asked
42. Trapping Rain Water
Calculate how much rain water can be trapped between elevation bars. Gusto uses this as a harder two-pointer showcase — they want the O(1)-space two-pointer solution and to hear the invariant explained: 'water level at any position is determined by the shorter of the two tallest walls seen so far from each side.'
- #49mediumcommonly asked
49. Group Anagrams
Group strings that are anagrams of each other. Gusto asks this to test hash-map design and key construction — the sorted-string key is the canonical approach, but they may push you to the character-count key for O(n·k) without sorting.
- #53easycommonly asked
53. Maximum Subarray
Find the contiguous subarray with the largest sum (Kadane's algorithm). Gusto asks this to see if you can articulate a greedy decision rule clearly — 'extend the current subarray or start fresh' — before writing a single line.
- #70easycommonly asked
70. Climbing Stairs
Count the number of distinct ways to reach the top of an n-step staircase taking 1 or 2 steps at a time. Gusto uses this to introduce dynamic programming — they want to see you recognise the Fibonacci recurrence and optimise from O(n) space to O(1).
- #121easycommonly asked
121. Best Time to Buy and Sell Stock
Find the maximum profit from a single buy-sell transaction. Gusto's payroll domain gives this a natural framing — think 'lowest payroll-cost day so far vs. current revenue day.' They want the greedy single-pass insight, not dynamic programming.
- #127hardrarely asked
127. Word Ladder
Find the shortest transformation sequence from beginWord to endWord changing one letter at a time. Gusto asks this to test BFS on implicit graphs — the graph is never explicitly built, and the neighbour-generation step (26 letter substitutions) is where candidates get bogged down without a clear strategy.
- #139mediumcommonly asked
139. Word Break
Determine if a string can be segmented into words from a dictionary. Gusto asks this to test DP thinking — specifically whether you can define the right subproblem and build the table bottom-up without getting tangled in overlapping recursion.
- #198mediumcommonly asked
198. House Robber
Maximise the sum of non-adjacent elements. Gusto asks this as a clean introductory DP problem — they want you to derive the recurrence yourself and then compress the O(n) space solution to O(1) without being prompted.
- #200mediumcommonly asked
200. Number of Islands
Count the number of islands in a grid. Gusto uses this to introduce graph traversal in a 2D setting — they want to see BFS or DFS with in-place marking, and to hear you articulate why each approach is equivalent before choosing one.
- #207mediumcommonly asked
207. Course Schedule
Determine whether all courses can be finished given prerequisite constraints — which is a cycle detection problem on a directed graph. Gusto asks this to test topological sort and graph reasoning in a domain they understand well: dependency graphs in their payroll and benefits configuration.
- #283easycommonly asked
283. Move Zeroes
Move all zeroes to the end of an array while preserving the relative order of non-zero elements, in-place. Gusto asks this to test the two-pointer write-cursor pattern and to see if you minimise unnecessary swaps.
- #347mediumcommonly asked
347. Top K Frequent Elements
Return the k most frequent elements. Gusto asks this to test frequency counting combined with efficient selection — they want to hear about bucket sort to get O(n) rather than defaulting to heap-sort at O(n log k).