Just a few days ago Databricks Online Assessment After finishing it, to be honest, I was relieved when I saw the title.
It's not the kind of hard questions that will make people die as soon as they come up, but very Databricks style: basic questions + clear ideas + no messy implementation.
There are three questions in the entire OA, and the time is enough. However, if you are not familiar with the underlying logic, you will really waste time on the details.

The first step is Design Hit Counter
When I see this question, I can basically confirm that it is a score-based question, but it is also the type that is most likely to be written as "it looks right, but actually has pitfalls".
The question asks you to design a click counter to count the number of hits in the past 300 seconds. The timestamp is monotonically increasing, and there can be multiple clicks in the same second. To put it bluntly, it is a time window statistics.
My first reaction was not to use a queue or a fixed-size array, but to directly use a list to store all timestamps. Because the question already tells you that time is increasing, then this list is naturally ordered.
The real key is GetHits(timestamp) At this moment: you are not going to a bar, but to quickly find the left edge of the window.
Window is [timestamp - 299, timestamp], this 299 is quite easy to make a mistake. I even paused to confirm. Then use bisection directly to find the first ≥ Timestamp - 299 The position, the number of elements behind it is the answer.
This Databricks question obviously does not test your space limit, but whether you can use known conditions to simplify the problem. If the interviewer asks further questions, just mention deque/bucket optimization. The most important thing is to write clearly and stably during the OA stage.
The second path is IP to CIDR
The "temperament" of this question suddenly changed. Jumping directly from string to bit operation, you can tell it at a glance:
People who understand can write quickly
People who don’t understand will get stuck and doubt their life
The question gives you an IPv4 address and n, and requires you to use the minimum CIDR blocks to cover the next n consecutive IPs.
The core of this question is not the CIDR representation itself, but a very classic bit operation technique:
Lowbit(x & -x)
What I did at the time was to first convert the IP into a 32-bit integer. As long as you don't do this, you won't be able to advance gracefully later.
Then every round, standing on the current IP, ask yourself two questions:
- At the binary level, what is the maximum block size that this IP can align?
- Will this block exceed the remaining n?
Lowbit gives the theoretical maximum aligned block, but if this block is larger than n, it can only be shrunk by continuously shifting to the right. After the block size is determined, the prefix can be calculated, and then the CIDR can be generated.
When writing this question, you must be steady and don't be too quick. Databricks' OA has a very low error tolerance rate for questions like "Once the logic is messed up, everything is wrong."
The third track is First Missing Positive
This is the most "algorithmic" question in the entire OA.
Seeing that the question requires O(n) time + O(1) extra space, you can basically throw away all the solutions such as set and sort. If you have solved this question before, it will be very smooth; if you have not, it will be almost impossible to figure it out on the spot.
The core idea is actually very simple, but not intuitive:
Treat the array as a hash table, using subscripts to indicate whether a value appears.
Only handle [1,n] Numbers within the range, put the number with value x into the subscript X-1 Position. Be sure to use it when exchanging While,no If, otherwise unhomed elements will be left.
After this round of "organizing in place" is over, scan the array again from the beginning. The first Nums[i] != i + 1 Location is the answer.
This Databricks question is obviously looking at your familiarity with the in-place algorithm, rather than just brushing up on the number of questions.
After completing these three questions as a whole, my feelings about Databricks OA are:
- Don't rely on sideways
- Doesn’t depend on question size
- It depends very much on whether your basic skills are solid.
- Is the code written clean, maintainable, and logically consistent?
If you have just "seen" these three questions, then OA will be a bit difficult;
But if you really understand the thinking behind it, Databricks' OA is a very good place to play.
If you want to prepare for the Databricks VO later, you can actually regard these three questions as a signal:
They care more about whether you can solve simple problems very steadily, rather than whether you can show off your skills.
This is actually very consistent with the engineering culture of Databricks.
Are basic questions more likely to be pitted?ProgramHelp Protect your OA
Databricks OA seems basic, but actually it has hidden secrets? Refuse to "roll over" on details! Although not all the questions in Databricks are Hard questions, they are like Design Hit Counter This kind of question examines the rigor of code implementation and the precise control of boundary conditions.
. Want to ensure a 100% pass rate and not miss out on opportunities because of a small bug? ProgramHelp provides you with the most professional OA assistance services. We have experienced algorithm experts who not only help you avoid the trap of "it looks right but actually has pitfalls", but also ensure that the code style complies with the standards of major manufacturers. Whether it’s complex logic or a corner case, ProgramHelp will help you get perfect scores and go straight to the next round of interviews!