之前刷到有人說 Verisk OA 偏應用場景題,這次我自己做下來,確實感受到題目更注重「實用性」,沒有很變態的演算法,但對細節和邊界要求很高。 整套下來包括選擇題、SQL 報表題和一道程式設計題,給大家還原一下。
題目 1: Big-O Notation
Question:
Big (O) notation… Pick ONE option
- identifies the best algorithm to solve a problem.
- determines maximum size of problem that can be solved on a system
- is the lower bound of growth rate of an algorithm.
- is the upper bound of the growth rate of an algorithm.
- None of the above.
👉 正確答案是第四個:Big-O notation 是描述演演算法增長率的上界(worst case)。
題目 2: SQL 報表
Question:
A marketing company maintains a database to track its advertising campaigns and engagements. The task is to generate a report that includes the name ofeach active campaign, the total number of engagements, and the sum of views and clicks for engagements.
- Only active campaigns should be included (
is_active = 1) - Columns:
campaign_name | total_engagements | total_views_and_clicks - Sorted by
campaign_name ASC
Schema:
campaigns (id, name, is_active)
engagements (campaign_id, views, clicks)
SQL 解法:
SELECT
c.name AS campaign_name,
COUNT(e.campaign_id) AS total_engagements,
COALESCE(SUM(e.views + e.clicks), 0) AS total_views_and_clicks
FROM campaigns c
JOIN engagements e
ON c.id = e.campaign_id
WHERE c.is_active = 1
GROUP BY c.name
ORDER BY c.name ASC;
👉 這裡注意要用 COALESCE 處理可能沒有 engagement 的情況,避免出現 NULL。
題目 3: 最小操作
Question:
For each word in a list, determine the minimum number of character replacements needed so that no two adjacent characters are the same.
Example:
words = ['add', 'book', 'break']
Output = [1, 1, 0]
Output = [1, 1, 0]
思路:
遍曆字串,遇到相鄰相同的字元就記一次替換操作。
因為替換掉一個字元就能解決這一對重複,所以統計所有相鄰相同對的數量即可。
Python 解法:
python
def minimalOperations(words):
res = []
for word in words:
count = 0
for i in range(1, len(word)):
if word[i] == word[i-1]:
count += 1
res.append(count)
return res
# 测试
print(minimalOperations(['add', 'book', 'break'])) # [1, 1, 0]
我的體驗
- Verisk OA 更像是对 基础知识+实用技能 的考察:复杂度、SQL 报表、字符串处理。
- 時間安排上建議選擇題 2 分鐘搞定,SQL/程式設計題要留更多時間測試邊界。
- 邊界條件很重要:空字串、單個字元、沒有 engagement 的 campaign 等情況都要考慮。
Programhelp 助你拿下 OA
Programhelp 團隊由 7 位來自頂尖 IT 院校(Oxford、Princeton、北大等)的學長學姐組成,均有 Amazon、Google、阿裡等一線大廠背景。 我們提供:
- OA 真題還原與講解
- 無痕遠端連線助攻
- 實時語音提醒 + Debug 指導
無論是 Verisk 還是其他大廠 OA/VO,我們都有成熟的全流程助攻方案,幫你在計時壓力下依然穩住發揮。