Queries Interview Questions
5 interview questions in our bank cover Queries, most of them Coding Questions. They average 2.4/5 difficulty — easy — and each one was reported by a candidate after a real interview. Companies known to ask about Queries: Uber, Amazon, Databricks, Microsoft, MathWorks.
Practice these on the problems board →Companies that ask about Queries
Question mix
- Coding Questions5
Difficulty
- 2/5 — easy3
- 3/5 — medium2
Questions tagged Queries
Count Ways to Reach a Sum
3/5Answer repeated questions about how many cross-array pairs reach a given total, drawing one value from each of two arrays. This Uber question is written as a story and reduces to counting with a frequency map, with the real decision being which array to index and which to scan. You will build the map once rather than per query, handle repeated values correctly, and keep the counts within integer range. Subscribers can read the complete problem and the reference solution.
Coding QuestionsUberCircular Array Multi-Query Distance Accumulation
2/5A coding question about a ring of stops joined by weighted segments and a long list of trips between pairs of stops. It tests picking the shorter direction around the loop, handling reversed and identical endpoints, and meeting a linear time bound over the whole batch of trips.
Coding QuestionsAmazonBinary String Requests
3/5Answer counting queries over a binary string while interleaved commands invert every character at once. This Databricks question is about not doing the work: rebuilding the string on each inversion is wasteful, so you keep a prefix-count table and a flag saying which symbol currently means zero. You will answer each count in constant time, flip the flag instead of the data, and get the inclusive index boundary right. Subscribers get the complete problem and the reference solution.
Coding QuestionsDatabricksCount Occurrences of the Suffix Maximum for Each Query
2/5An array question about answering many lookups quickly: each lookup names a starting position and asks a frequency question about the largest value from there onward. With a hundred thousand lookups, rescanning is too slow, so it rewards a single backward pass and careful handling of negative numbers and ties.
Coding QuestionsMicrosoftHas Vowels
2/5Answer many range queries asking how many strings in a slice both begin and end with a vowel. This MathWorks question is a prefix-sum exercise: classify each string once, accumulate a running count, and every query becomes a subtraction. You will get the inclusive bounds right, handle single-character strings where the first and last letter coincide, and keep the per-query cost constant. A subscription unlocks the full problem and the reference solution.
Coding QuestionsMathWorks
Studied alongside
Queries interview FAQ
- How many Queries interview questions are there?
- 5 reported questions, mostly Coding Questions.
- Which companies ask Queries questions?
- Uber (1), Amazon (1), Databricks (1), Microsoft (1), MathWorks (1).
- How hard are Queries questions?
- They average 2.4 out of 5: 3 at 2/5, 2 at 3/5.