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

Databricks计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(129)
OOD(6)
Algorithm(60)
System Design(45)
高频题(0)
Math(0)
全部(129)
OOD(6)
Algorithm(60)
System Design(45)
高频题(0)
Math(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.Bookstore Purchase Decision
38.Discuss the pros and cons of using TreeMap and array + sort methods for solving a Revenue problem
39.Optimizing Data Structure for Revenue and Referral System
40.Implement Encoder and Decoder for RLE and BP Encoding Schemes
41.Calculate the Number of Pairs in Two Arrays
42.Segmentation Count After Tree Destruction
43.Count Subarrays with K Duplicate Pairs
44.Sorting Matrix Diagonal Weights
45.Alphabetically Smallest String by Reversing Substrings
46.Lamps Illumination on a Number Line
47.Robot Movement on a Board with Lasers
48.Count Unix Command Calls
49.Implement a Log Writer
50.Delete Index from Interval
51.Map Get and Put Operations Performance
52.Design a Book Store System
53.Design a Multi-threaded Log Writer
54.Design a File Storage Service
55.Implement and Test a LazyArray API
56.Design a Group Chat System with Message Deletion
57.Designing a User-Friendly API for a LazyArray
58.Improving Throughput for a FileWriter Accessed by Multiple Threads
59.Optimizing Query Performance for a Columnar Database
60.Customer Revenue Calculation with Nested Revenue and Depth Limitation
61.Rate Limiter for Virtual Machines in a Host
62.Multi-threaded Data Writer Persistence Guarantee
63.Interval Array Modification
64.Firewall Rules CIDR Check
65.Implement and Test LazyArray
66.Implement Referrer Revenue Data Structure
67.Design a Collaborative Music Playlist
68.Design a Visa Payment Network
69.Array of Intervals Deletion
70.Design a Web Service for Selling Books
71.Minimum Missing Positive Integer in Submatrices
72.Array Rearrangement to Descending Order
73.Character Connection in Array
74.Counting 1s in a Binary String
75.CamelCase Conversion in a String
76.Reformat a String by Alternating Characters
77.Range Frequency Queries Optimization
78.Bubble Pop Game Matrix Operation
79.String Splitting Problem
80.String Transformation Based on Adjacent List Items
81.Web Crawler System Design
82.Map Walking Optimization
83.Map Walking Optimization
84.Find Shift Amount for Sorted Array
85.Rearrange Array Elements
86.Implement a Variant of Tic Tac Toe
87.Graph Merging with Randomness
88.Design a SnapshotSet Interface
89.String Pattern Matching
90.Implement and Test a LazyArray
91.Design a Distributed File System
92.Design a Single-Machine Key-Value Store
93.Identify Bottleneck Nodes in a Directed Graph
94.Design a system to get the lowest k customers by total revenue exceeding a threshold
95.Bubble Operations on a 2D Matrix
96.Substring Splitting Based on Array Index
97.Design a Credit Card Authorization System
98.Longest Continuous Subarray with Limited Difference
99.Find Local Maxima in a Matrix
100.Pattern Matching in a Digit-Only String
101.Find the Index of the First Local Minimum in an Array
102.Find the Index of the First Element Smaller Than Its Neighbors
103.Find the Index of the First Element Smaller Than Its Neighbors
104.Number Pairs with Single Digit Difference
105.Array Cycle Sorting
106.Prefix Sum Problem
107.Design Customer Revenue Tracking System with Referral Feature
108.Balloon Popping
109.Count Matching Subsequences
110.Design a Collaborative Music Playlist System
111.Design a VISA Settlement System
112.Design a Stock Trading System
113.Tic Tac Toe Game Coding
114.Multi-thread Web Crawler
115.Systems Architecture for a Trading System
116.Design a Visa Network
117.Prefix Pair Count in a String Array
118.Memory Allocation and Erasure Simulation
119.Count Words with More Than Three Repeated Letters
120.Key Switch Count
121.Old Algorithm Question: IP
122.Tic Tac Toe Variant Coding Challenge
123.Design a Suspension Game Architecture
124.Design a File Storage System
125.Design a SnapshotSet
126.Fastest Route to Databricks HQ
127.Design a Visa Network System for Authorization Only
128.Describe your most technically challenging project
129.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求最小值)