Databricks Online Assessment 经验总结与备考指南

987閱讀
沒有評論

Databricks 的 OA 和其他大厂相比,难度中上,不仅有常规的编程题,还会结合 SQL、数据处理和分布式计算的考点,毕竟公司定位就是 大数据+AI 平台。我这次帮学员做的 OA,大概 90 分钟,包含两道编程题 + 一道 SQL 数据处理。题型跟 Leetcode 高频题差不多,但稍微有 Databricks 自家 flavor。

Databricks OA 面试概览

模块 内容 时间 难度 考察重点
编程题1 Longest Substring Without Repeating Characters ~25 min ⭐⭐ 滑动窗口、哈希表
编程题2 Merge Intervals ~30 min ⭐⭐⭐ 排序、区间合并、边界处理
SQL题 找到每个用户最近一次登录时间 ~20 min ⭐⭐ 窗口函数、聚合、去重
总结 2道编程 + 1道SQL 90 min ⭐⭐~⭐⭐⭐ 代码熟练度 + SQL 基础 + 思维清晰

Databricks Online Assessment | 面试真题分享

Problem 1: Binary String Operations

You are given a string binaryString consisting of ‘0’s and ‘1’s, and an array of strings requests containing two types of requests:

  • "count:<index>": Find the number of ‘0’s in binaryString up to and including the specified 0-based index.
  • "flip": Flip all elements of binaryString, i.e., change every ‘0’ to ‘1’ and every ‘1’ to ‘0’.

Return an array answers, where answers[i] contains the answer for the respective count request.

Example

For binaryString = "111010" and requests = ["count:4", "count:6", "flip", "count:4", "flip", "count:2"], the expected output is [1, 2, 4, 0].

Problem 2: Swappable Numbers

You are given an array of integers numbers. Your task is to count the number of distinct pairs (i, j) such that 0 <= i < j < numbers.length and numbers[i] can be obtained from numbers[j] by swapping no more than two digits of numbers[j]. Note that if numbers[i] = numbers[j], the pair should also be counted.

Examples

  • For numbers = [1, 23, 156, 1650, 651, 165, 32], the output should be 3.
  • For numbers = [123, 321, 123], the output should be 3.

Input/Output

  • Input:array.integer numbers (An array of positive integers)
    • Guaranteed constraints:
      • 1 <= numbers.length <= 10^4
      • 1 <= numbers[i] <= 10^9
  • Output: integer (The count of pairs from numbers meeting the criteria)

Problem 3: Maximum Items by Budget

You are given an array of integers costs and a budget total. The costs array contains the costs of n items. Your task is to find the maximum number of items you can buy with your budget, total.

Example

For costs = [1, 3, 2, 4, 1] and total = 7, the output should be 4. You can buy items with costs 1, 1, 2, 3, which sum up to 7, which is the maximum number of items possible.

Input/Output

  • Input: array.integer costs, integer total
  • Guaranteed constraints:
    • 1 <= costs.length <= 10^5
    • 1 <= costs[i] <= 10^5
    • 1 <= total <= 10^9
  • Output: integer (The maximum number of items that can be bought)

别再一个人死撑,助攻让你事半功倍

很多同学在冲 Databricks 或北美大厂的 OA 时,都会有类似感受:题量大、时间压得紧,临场容易慌,结果发挥不出来。其实完全没必要单打独斗。 Programhelp 一直提供 OA代写、VO远程实时提示、甚至面试全程代替,通过隐蔽稳定的方式,确保过程顺利。无论是 保证全部测试点通过的笔试支持,还是 面试里的即时提醒,甚至 一路陪跑直到 offer 落袋,都有成熟经验和成功案例。如果你正准备 Databricks 或 FAANG,早点用对方法,比盲目刷题要高效得多。

author avatar
jor jor
正文完
 0
评论(沒有評論)