7 quickselect interview questions, asked at Meta, Google, Airbnb and 2 more companies. Last asked Aug 2026.
+2
Top k largest elementsCodingGiven an integer array nums and an integer k, return the k largest elements of nums. You may return them in any order. The result is a multiset. If a value appears several times…
Kth largest element in an arrayCodingReturn the k-th largest element of an unsorted array. Compare sorting, a size-k min-heap and quickselect, with their time and space costs.
Last asked Feb 2026
Top K most active users from chat logsCodingYou get chat log lines, each naming the users involved. Return the k users who took part in the most chats. Count with a hash map, then compare picking the top k by sorting, by a…
Last asked Dec 2025
K closest points to the originCodingGiven points in the plane and k, return the k points nearest to the origin in any order. Start simple (sort by distance), then improve with a size-k max-heap or quickselect and…
Last asked Oct 2025
Best single location on a line to minimize total distanceCodingYou are choosing one location on a number line to serve a set of sites. You are given a non-empty integer array nums. Each value is the coordinate of a site (values may repeat and…
+2
Median of a large unsorted array in linear timeCodingYou are given a very large, unsorted list of integers nums. Return its median. - If len(nums) is odd, the median is the middle value once the list is sorted. - If len(nums) is…