这次 11.18 的 Akuna OA ,我们这边带的几位同学整体反馈都比较一致:题目不难,但写得是否干净利落,差距一下就拉开了。Akuna 本身对代码质量、思路完整性非常敏感,所以这份解析我们按真实做题体验做了复盘,希望能给后来人一个更清晰的参考。
Problem 1 — Find the shortest lexicographically smallest substring containing k ‘I’
Given a string s and an integer k, return the shortest substring of s that contains at least k occurrences of the character 'I'.
If multiple substrings have the same shortest length, return the lexicographically smallest one.
这题属于典型的“不要想复杂,直接写就行”的类型。
题意摘要: 给你字符串 s 和整数 k,要找一个 substring,里面至少/恰好含 k 个 ‘I’。 在所有满足条件的子串里:
先比长度(越短越好)
长度相同再比字典序
我们建议的稳定思路:
外层 loop 枚举每个起点 i
里层往后扫,直到凑够 k 个 ‘I’
只要满足条件就把当前 substring 记下来
最后对所有 substring 排序: length → lexicographical order
这种写法易写、易 debug,也方便在压力环境下快速 AC。
Problem 2 — Compute accumulat…
这次 11.18 的 Akuna OA ,我们这边带的几位同学整体反馈都比较一致:题目不难,但写得是否干净利落,差距一下就拉开了。Akuna 本身对代码质量、思路完整性非常敏感,所以这份解析我们按真实做题体验做了复盘,希望能给后来人一个更清晰的参考。
Problem 1 — Find the shortest lexicographically smallest substring containing k ‘I’
Given a string s and an integer k, return the shortest substring of s that contains at least k occurrences of the character 'I'.
If multiple substrings have the same shortest length, return the lexicographically smallest one.
这题属于典型的“不要想复杂,直接写就行”的类型。
题意摘要: 给你字符串 s 和整数 k,要找一个 substring,里面至少/恰好含 k 个 ‘I’。 在所有满足条件的子串里:
先比长度(越短越好)
长度相同再比字典序
我们建议的稳定思路:
外层 loop 枚举每个起点 i
里层往后扫,直到凑够 k 个 ‘I’
只要满足条件就把当前 substring 记下来
最后对所有 substring 排序: length → lexicographical order
这种写法易写、易 debug,也方便在压力环境下快速 AC。
Problem 2 — Compute accumulated left-side differences for each element
For an array arr of size n, for each position i, compute a value:
-
For every
j < i: -
If
arr[j] < arr[i], add(arr[i] - arr[j]) -
Else subtract
(arr[j] - arr[i])
Return the result array of size n.
这题我们带学员遇到过非常多次,本质就是一个 O(n²) 的稳定题,不需要花哨优化。
题意摘要:
给数组 arr,对每个位置 i:
- 遍历所有
j < i - 如果
arr[j] < arr[i]→ 加(arr[i] - arr[j]) - 如果
arr[j] > arr[i]→ 减(arr[j] - arr[i])
最后把每个位置累计出来的结果塞回 result 数组。
实战可交付方案:
- 两层循环直接写
- 边界特别清晰,不容易写错
- 面对任何 tricky input 都不会翻车
对于 Akuna,稳和准永远比炫技更重要。
Problem 3 — Find the maximum-weight k-star subgraph
You are given a weighted undirected graph.
Each node has a weight.
A k-star is defined as choosing one node as the center and selecting up to k of its neighbors.
The score of this star is:
center_weight + sum of the weights of the selected neighbors
Only neighbors with positive weight should be selected. Return the maximum score over all possible centers.
这是 Akuna 一直爱考的“轻图论 + 直觉贪心”。
题意摘要:
- 给加权图
- 选一个节点做中心
- 从邻居里挑最多
k个正权值节点 - 得分 = 中心权值 + 前 k 个邻居权值之和
- 要最大化这个得分
Programhelp 给学员的通关方案:
- 用 adjacency list 存图
- 对每个节点:
- 把所有邻居权值抓出来
- 从大到小排序
- 取前 k 个正值
- 计算总和,更新最大值
思路清爽、写法不容易乱,是那种“写完基本稳过”的标准解。
从迷茫到上岸,我们都能陪你一起走
如果你这段时间也在准备 Akuna、HRT、Citadel、Optiver 这些 Quant/Trading 系列的 OA 或 VO,其实你完全不用一个人硬扛。我们今年已经陪着很多同学从入门到稳稳上岸,最大的收获就是: 只要有人帮你把题型、节奏、注意事项兜住,你的发挥会比你想象得更稳定。
- 通过 ToDesk 远程联机
- 在你的环境里 无痕处理整个 OA 流程
- 所有测试用例100% 通过,否则不收费
- 适用于各类 OA 平台(HackerRank / CodeSignal / Codility / HireVue code 等)
重点是: 整个过程不会留下任何痕迹,也不会被平台检测到,真正做到 稳、快、干净。
如果你现在正被某个 OA 卡着、或者担心因为时间压力翻车,完全可以来聊聊你的情况,我们会根据题型帮你规划最稳的通关方式。