Databricks Interview Questions

Databricks Interview Questions

Databricks is an American enterprise software company founded by the creators of Apache Spark. Databricks develops a web-based platform for working with Spark, that provides automated cluster management and IPython-style notebooks.

It has got a 4.7* rating on Glassdoor and is considered one of the best product-based companies. It is highly regarded for its work-life balance.

They provide good training as well which will be beneficial in future too. You can practice the below Databricks Interview Questions for the interview. We have collected past frequently asked Databricks Interview Questions for your reference.

Databricks Array Questions

Question 1. Minimum Increment to Make Array Unique Leetcode Solution Problem Statement: Minimum Increment to Make Array Unique Leetcode Solution – You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums[i] by 1. Return the minimum number of moves to make every value in nums unique. ...

Read more

Question 2. Insert Delete GetRandom O(1) Leetcode Solution Problem Statement The Insert Delete GetRandom O(1) LeetCode Solution – “Insert Delete GetRandom O(1)” asks you to implement these four functions in O(1) time complexity. insert(val): Insert the val into the randomized set and return true if the element is initially absent in the set. It returns false when the ...

Read more

Question 3. Trapping Rain Water Leetcode Solution Problem Statement The Trapping Rain Water LeetCode Solution – “Trapping Rain Water” states that given an array of heights which represents an elevation map where the width of each bar is 1. We need to find the amount of water trapped after rain. Example: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: Check ...

Read more

Question 4. Count all subsequences having product less than K The problem “Count all subsequences having product less than K” states that you are given an array of integers. Now find the number of subsequences that have a product less than a given input K. Example a[] = {1, 2, 3, 4, 5} k = 8 Number of subsequences less ...

Read more

Question 5. Sum of minimum and maximum elements of all subarrays of size k Problem Statement The problem “Sum of minimum and maximum elements of all subarrays of size k” states that you are given an array containing positive and negative integers, find the sum of minimum and maximum elements of all the sub-arrays of size k. Examples arr[] = {5, 9, 8, 3, ...

Read more

Question 6. Count subarrays with equal number of 1’s and 0’s Problem Statement The problem “Count subarrays with equal number of 1’s and 0’s” states that you are given an array consisting of 0’s and 1’s only. The problem statement asks to find out the count of sub-arrays consisting equal no of 0’s ad 1’s. Example arr[] = {0, 0, 1, ...

Read more

Question 7. Count subarrays having total distinct elements same as original array Problem Statement “Count subarrays having total distinct elements same as original array” states that you are given an integer array. The problem statement asks to find out the total number of sub-arrays that contain all distinct elements as present in an original array. Example arr[] = {2, 1, 3, 2, ...

Read more

Question 8. Find the smallest positive integer value that cannot be represented as sum of any subset of a given array Problem Statement You are given a sorted array of integers. We need to find the smallest positive integer value that cannot be represented as sum of any subset of a given array. Example arr[] = {1,4,7,8,10} 2 Explanation: Because there is not any sub-array that can represent 2 as a ...

Read more

Question 9. Printing brackets in Matrix Chain Multiplication Problem Problem Statement We need to find the order of multiplication of matrices such that the number of operations involved in the multiplication of all the matrices is minimized. Then we need to print this order i.e. printing brackets in matrix chain multiplication problem. Consider you have 3 matrices A, B, ...

Read more

Question 10. Find Three Element From Different Three Arrays Such That a + b + c = sum Three Sum is a problem loved by interviewers. It is a problem I was personally asked during the Amazon interview. So, without wasting any more time let us get to the problem. An array that has both positive and negative numbers. Three numbers that sum up to zero/can be modified, ...

Read more

Question 11. Trapping Rain Water LeetCode Solution In the Trapping Rain Water LeetCode problem, we have given N non-negative integers representing an elevation map and the width of each bar is 1. We have to find the amount of water that can be trapped in the above structure. Example Let’s understand that by an example For the ...

Read more

Question 12. Smallest Positive Number Missing in an Unsorted Array Problem Statement In the given unsorted array find the smallest positive number missing in an unsorted array. A positive integer doesn’t include 0. We can modify the original array if needed. The array may contain positive and negative numbers. Example a. Input array : [3, 4, -1, 0, -2, 2, 1, ...

Read more

Databricks String Questions

Question 13. Letter Combinations of a Phone Number In letter combinations of a phone number problem, we have given a string containing numbers from 2 to 9. The problem is to find all the possible combinations that could be represented by that number if every number has some letters assigned to it. The assignment of the number is ...

Read more

Question 14. Decode Ways In Decode Ways problem we have given a non-empty string containing only digits, determine the total number of ways to decode it using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Example S = “123” Number of ways to decode this string is 3 If we ...

Read more

Question 15. Convert a String that is Repetition of a Substring of Length K Problem Statement In the “Convert a String that is Repetition of a Substring of Length K” problem we have given a string “s” and an integer “k”. Write a program to check whether is it possible to convert it to a string that is the repetition of a substring with ...

Read more

Databricks Tree Questions

Question 16. Check whether a given Binary Tree is Complete or not Problem Statement The problem “Check whether a given Binary Tree is Complete or not” states that you are given the root of a binary tree, check whether the tree is complete or not. A complete Binary Tree has all its levels filled except for the last level and the nodes ...

Read more

Databricks Stack Questions

Question 17. Trapping Rain Water Leetcode Solution Problem Statement The Trapping Rain Water LeetCode Solution – “Trapping Rain Water” states that given an array of heights which represents an elevation map where the width of each bar is 1. We need to find the amount of water trapped after rain. Example: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: Check ...

Read more

Question 18. Trapping Rain Water LeetCode Solution In the Trapping Rain Water LeetCode problem, we have given N non-negative integers representing an elevation map and the width of each bar is 1. We have to find the amount of water that can be trapped in the above structure. Example Let’s understand that by an example For the ...

Read more

Databricks Queue Questions

Question 19. Sum of minimum and maximum elements of all subarrays of size k Problem Statement The problem “Sum of minimum and maximum elements of all subarrays of size k” states that you are given an array containing positive and negative integers, find the sum of minimum and maximum elements of all the sub-arrays of size k. Examples arr[] = {5, 9, 8, 3, ...

Read more

Question 20. Check whether a given Binary Tree is Complete or not Problem Statement The problem “Check whether a given Binary Tree is Complete or not” states that you are given the root of a binary tree, check whether the tree is complete or not. A complete Binary Tree has all its levels filled except for the last level and the nodes ...

Read more

Databricks Matrix Questions

Question 21. Printing brackets in Matrix Chain Multiplication Problem Problem Statement We need to find the order of multiplication of matrices such that the number of operations involved in the multiplication of all the matrices is minimized. Then we need to print this order i.e. printing brackets in matrix chain multiplication problem. Consider you have 3 matrices A, B, ...

Read more

Databricks Other Questions

Question 22. Time Based Key-Value Store LeetCode Solution Problem Statement Time Based Key-Value Store LeetCode Solution – Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key’s value at a certain timestamp. Implement the TimeMap class: TimeMap() Initializes the object of the data structure. void set(String key, String ...

Read more

Question 23. Design Skiplist LeetCode Solution Problem Statement Design Skiplist LeetCode Solution – Design a Skiplist without using any built-in libraries. A skip list is a data structure that takes O(log(n)) time to add, erase and search. Compared with the tree and red-black tree which has the same function and performance, the code length of Skiplist can be comparatively ...

Read more

Question 24. Rotate Image LeetCode Solution Problem Statement Rotate Image LeetCode Solution – You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example Test Case 1: Input: ...

Read more

Question 25. Closest Leaf in a Binary Tree LeetCode Solution Problem Statement Closest Leaf in a Binary Tree LeetCode Solution – Given the root of a binary tree where every node has a unique value and a target integer k, return the value of the nearest leaf node to the target k in the tree. Nearest to a leaf means the least number of edges traveled on the binary tree to ...

Read more

Question 26. Merge K Sorted Linked Lists Merge K sorted linked lists problem is so famous as per the interview point of view. This question asks so many times in big companies like Google, Microsoft, Amazon, etc.  As the name suggests we’ve been provided with k sorted linked lists. We have to merge them together into a ...

Read more

Question 27. Sliding Window Maximum In Sliding Window Maximum problem we have given an array nums, for each contiguous window of size k, find the maximum element in the window. Example Input nums[] = {1,3,-1,-3,5,3,6,7} k = 3 Output {3,3,5,5,6,7} Explanation Naive Approach for Sliding Window Maximum For every contiguous window of size k, traverse ...

Read more

Translate »