Top Algorithms Interview Questions (2026)
Practice the 42 most-asked Algorithms interview questions, each with a model answer, key points, and the mistakes to avoid. Filter by difficulty, reveal answers, and rate your confidence to track how interview-ready you are.
42 questions Open in question bank
Algorithms questions
- Uber OA: To find the shortest driving time between two points on a road network with non-negative travel times, which algorithm is the standard choice?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- Airbnb OA: To find whether any two listings have overlapping booking date intervals among n intervals, which approach is optimal?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- Airbnb OA: The 'search listings within a price budget maximizing total rating' where each listing is taken at most once is an instance of which classic problem?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- Given a batch of N profile-view counts (one count per profile) with K much smaller than N, which approach finds the top K most-viewed profiles in a single pass using only O(K) extra memory, and how does it compare with heapify-all and quickselect?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- You need to detect whether a directed connections graph (member to member) contains a cycle. Which algorithm correctly detects a cycle in a directed graph?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- You are parsing monetary amounts for a payment API. Why should currency amounts generally be stored and computed as integer minor units (e.g., cents) rather than as IEEE-754 doubles?Intermediate· multiple choice₹99 (Interview Prep or Pro plan required)
- A currency-conversion feature needs exchange rates between currencies where only some direct pairs are known. Modeling currencies as nodes and known rates as weighted edges, which approach finds a conversion path and detects an arbitrage (profit) cycle?Expert· multiple choice₹499 (Pro plan required)
- What is the time complexity of the following Python code? total = 0 for i in range(n): for j in range(i, n): total += 1Beginner· multiple choiceFree
- In C, what is the result of printf("%d", x++ + ++x); with int x = 5;, and what does the corrected code int a = x++; int b = ++x; print?Intermediate· output based₹99 (Interview Prep or Pro plan required)
- In pseudocode, what does the following loop compute for a positive integer n? result = 1 while n > 1: result = result * n n = n - 1 return resultBeginner· multiple choiceFree
- Which sorting algorithm is stable and guarantees O(n log n) time in the worst case?Intermediate· multiple choiceFree
- Find the maximum sum of a contiguous subarray (Kadane's algorithm).Beginner· codingFree