<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KVGHS6G" height="0" width="0" style="display:none;visibility:hidden"></iframe>

Databricks面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
全部(0)
1.lazy array
2.Design WebCrawler
3.check obstacles
4.设计total revenue系统
5.求figure掉下来之后的board状态
6.最便宜的车票
7.string formatting
8.Design a stock buy/sell exchange system
9.设计一个mockHashMap
10.计算所有后缀pair的个数
11.重新排版字符串
12.判断单调递增/递减
13.实现一个迭代器
14.实现lazy array
15.shortest distance II
16.Time-Based Key-Value Store Design
17.RemoveCommentsFromCPPCode
18.String changable
19.SnapshotSet
20.StringBuilder
21.Merge k Sorted Lists
22.Common ancestor
23.List of coordinates
24.Text editor
25.Class
26.Root url
27.Time-Based Key-Value Store
28.House Robber Problem with Variations
29.Lazy Array API Behavior
30.Design Tic-Tac-Toe for M x N Board
31.IP CIDR Rule Check
32.Max Area of Island
33.Simulate a Circuit Breaker
34.Snapshot Set with Current State Iterator
35.Fibonacci Tree Move Sequence
36.Key-Value Store with Query Per Second (QPS) Calculation
37.Handling Edge Cases in Data Frames
38.Data Manipulation with Python Data Frames
39.Bookstore Purchase Decision
40.Discuss the pros and cons of using TreeMap and array + sort methods for solving a Revenue problem
41.Optimizing Data Structure for Revenue and Referral System
42.Implement Encoder and Decoder for RLE and BP Encoding Schemes
43.Calculate the Number of Pairs in Two Arrays
44.Count Contiguous Subarrays with Alternating Even and Odd Numbers
45.Longest Diagonal Pattern Streak in Matrix
46.Word Recovery from Skeletons
47.Count Elements with Odd Number of Zero Occurrences
48.Longest Segment of Contiguous Houses
49.Calculate the Final Position of a Falling Figure in a Matrix
50.Version Control System Branch with Most Files
51.Count Elements with Even Number of Digits
52.Segmentation Count After Tree Destruction
53.Count Subarrays with K Duplicate Pairs
54.Sorting Matrix Diagonal Weights
55.Alphabetically Smallest String by Reversing Substrings
56.Lamps Illumination on a Number Line
57.Robot Movement on a Board with Lasers
58.Count Unix Command Calls
59.Implement a Log Writer
60.Delete Index from Interval
61.Map Get and Put Operations Performance
62.Design a Book Store System
63.Behavioral Interview Questions
64.Design a Multi-threaded Log Writer
65.Design a File Storage Service
66.Implement and Test a LazyArray API
67.Design a Group Chat System with Message Deletion
68.Designing a User-Friendly API for a LazyArray
69.Improving Throughput for a FileWriter Accessed by Multiple Threads
70.Optimizing Query Performance for a Columnar Database
71.Customer Revenue Calculation with Nested Revenue and Depth Limitation
72.Deep Dive into Project Management
73.Rate Limiter for Virtual Machines in a Host
74.Multi-threaded Data Writer Persistence Guarantee
75.Interval Array Modification
76.Firewall Rules CIDR Check
77.Implement and Test LazyArray
78.Implement Referrer Revenue Data Structure
79.Design a Collaborative Music Playlist
80.Design a Visa Payment Network
81.Array of Intervals Deletion
82.Design a Web Service for Selling Books
83.Minimum Missing Positive Integer in Submatrices
84.Array Rearrangement to Descending Order
85.Character Connection in Array
86.Count Distinct Pairs with Similar Digits
87.Convert Snake Case to Camel Case in Substrings
88.Student with Highest Average Grade
89.Array Transformation Based on Characters
90.Counting 1s in a Binary String
91.CamelCase Conversion in a String
92.Reformat a String by Alternating Characters
93.Range Frequency Queries Optimization
94.Bubble Pop Game Matrix Operation
95.String Splitting Problem
96.String Transformation Based on Adjacent List Items
97.Web Crawler System Design
98.Map Walking Optimization
99.Map Walking Optimization
100.Valid Pair Count in Array
101.Valid Skeleton Word Count
102.Find Shift Amount for Sorted Array
103.Rearrange Array Elements
104.Implement a Variant of Tic Tac Toe
105.Graph Merging with Randomness
106.Design a SnapshotSet Interface
107.Point Range Count
108.Maximum Sum Frame in a Matrix
109.String Pattern Matching
110.Stock Price Analysis
111.Implement and Test a LazyArray
112.Design a Distributed File System
113.Design a Single-Machine Key-Value Store
114.Identify Bottleneck Nodes in a Directed Graph
115.Design a system to get the lowest k customers by total revenue exceeding a threshold
116.Bubble Operations on a 2D Matrix
117.Substring Splitting Based on Array Index
118.Design a Credit Card Authorization System
119.Classification Metrics Comprehension
120.Understanding Linear Regression Assumptions
121.SQL Second Degree Follower Problem
122.Longest Continuous Subarray with Limited Difference
123.Find Local Maxima in a Matrix
124.Pattern Matching in a Digit-Only String
125.Find the Index of the First Local Minimum in an Array
126.Find the Index of the First Element Smaller Than Its Neighbors
127.Find the Index of the First Element Smaller Than Its Neighbors
128.Number Pairs with Single Digit Difference
129.Matrix Manipulation
130.Array Cycle Sorting
131.Prefix Sum Problem
132.Design Customer Revenue Tracking System with Referral Feature
133.Count Road Lamp Coverage
134.Balloon Popping
135.Rank Teams by Points
136.Count Matching Subsequences
137.Binary String Operations
138.Bubble Match Game State
139.Calculate Waiting Time for the Next Bus
140.Design a Collaborative Music Playlist System
141.Design a VISA Settlement System
142.Design a Stock Trading System
143.Tic Tac Toe Game Coding
144.Multi-thread Web Crawler
145.Systems Architecture for a Trading System
146.Design a Visa Network
147.Prefix Pair Count in a String Array
148.Memory Allocation and Erasure Simulation
149.Count Words with More Than Three Repeated Letters
150.Key Switch Count
151.Amazon Behavioral Questions
152.Old Algorithm Question: IP
153.Tic Tac Toe Variant Coding Challenge
154.Design a Suspension Game Architecture
155.Design a File Storage System
156.Design a SnapshotSet
157.Fastest Route to Databricks HQ
158.Design a Visa Network System for Authorization Only
159.Describe your most technically challenging project
160.Design a Key-Value Store with Timestamps
1. lazy array
// lazy array,要求实现arraymap(…).indexOf(…),其中map传进去一个function,
//indexOf返回运行了所有function之后传入值的index。要求map的操作最后再做,所以叫 lazy array。 For example:
// arr = LazyArray([10,20, 30,40, 50])
/arrmap(lambdaxx*2)indexOf(40)---->1
//arrmap(lambda xx*2)map(lambdaxx*3)indexOf(240)->3注意这里重新开了一个chain,上一行的map就不计算在内了
After finishing the implementation, asked about how to make class unit test friendly And write unit test for the class.
Then ask how to improved the performance of lazyArray. My answer is using cache to store chain and correponding calculated value.
2. Design WebCrawler

First write single threaded Web Crawler, Then write multi-threaded WebCrawler
/开始提供了三个utilityfunction:
/(1)fetch(urL:url)->HTML:content:
//(2)parse(HTML:content)->List<URL>;
//(3)save(URL:url,HTML:content)。
//save是把数据存在disk上,"fetch是发个network request,
//parse是in-memory解析html page,
/**
*improve the efficiency by multi-thread
* keys
*1-avoid race condition where 2 threads check same url
*and try to process as next url at same time (this causes duplicate visit on same url)
*use concurrentHashMap put to avoid, since the put (insert entry) lock the segment
of map
* and if return null meaning no such key in map previously which means we can process the url
*2- save is a disk 1/0 where we should put it into a separate thread pool to let it finish byitself
*3- fetch html is a networki/0

*/
3. check obstacles

input:
二维整型数组operations,每一个元素有两种可能,对应两种不同的操作:
1) [1,x]:在坐标(无限延伸)的x位置放一个obstacle
2)[2,l,x]:check当前[x-l,x]上有无obstacle,若有则在结果字符串上append1,否则
在结果字符串上append 0
Return:
字符串res,res.charAt(i)对应在operations中出现的第i个check操作的结果
example:
input :operations=[[1,2],[2,2,3],[1,5],[2,8,1]]
output:”01”
explaination:
a)[1,2]:在×=2上放一个obstacle
b)[2,2,3]在内存在[3-2,3]一个obstacle(x=2),所以往res中append0
C)[1,5]:在x=5上放一个obstacle
d)[2,8,1]因为在[7,8]区间范围内不存在obstacle所以我那个res中append1
d128在内不存在bstacle,所以我那个res中append1
4. 设计total revenue系统
写一个算total revenue的系统,给两个参数,一个list of string priceList,另一个list of
string log
priceList例子:["itemname:priceNumber","cup:10”]
log例子:有点复杂具体忘了,但是全是字符串。大意有三种字符串:1.卖什么物品卖几件
2.打折开始什么物品减价多少maxcount(卖几件后恢复原价)3.打折结束
5. 求figure掉下来之后的board状态
给一个二维度矩阵board,该board中的元素可以为三种char,分别为:1."."代表空格2.’F’代表figure3.’#’代表障碍。其中fiqure是连为一体的,并且会往下掉;当figure遇到障碍或bottom时,整体会停下来。求figure掉下来之后的board状态,返回board。

按要求最小的move steps然后让F进行相应的移动。注意每一列如何找最小的move steps(从上往下每一个#和它之前离他最近的F的差再-1,这些diff求最小值)