这篇文章不是简单整理题目,而是基于我们在 ProgramHelp 实际协助多位同学参加 TSMC OA 的过程中,总结出的真实题型结构、出题逻辑和最容易被刷掉的关键点。如果你正在准备 TSMC 的 Software / IT / System / Data 相关岗位,这一轮 HackerRank OA 基本是绕不开的第一关。
TSMC OA 的真实定位
从我们接触的多场 OA 来看,TSMC 的 HackerRank 测试特点非常明确:它不追求高难度算法,而是极度重视逻辑完整性、边界条件处理以及在有限时间内稳定输出可运行代码。这也是为什么很多同学会觉得“题目看起来不难,但就是没过”——问题往往不在算法,而在细节。
TSMC HackerRank OA 基本形式
以 Software / IT Engineer 方向为例,近一年的 OA 结构高度一致:
平台:HackerRank
时长:约 90 分钟
题目数量:3 题
语言支持:Python / Java / C++ / C 等主流语言,需要完全适应 HackerRank 环境,从结果反馈来看,至少稳定通过2.5题,才会进入后续筛选。
真实出现过的 OA 题型方向
以下是我们在协助过程中反复出现的几类题型方向,已经做过结构性抽象,不涉及原题泄露。
1. Group Division
A university has admitted a group of n students with varying skill levels. To better accommodate the students, the university has decided to create classes tailored to these skill levels. A placement examination returns a skill level for each student, represented by an array levels[], where levels[i] denotes the skill level of student i.
All students within a group must have skill levels that are within a specified range, maxSpread, of one another. The goal is to determine the minimum number of groups that must be formed to ensure that no group contains students whose skill levels differ by more than maxSpread.
Example
Input:
n = 5(number of students)levels = [1, 4, 7, 3, 4](skill levels of the students)maxSpread = 2(the maximum allowed skill level difference within a group)
Output:
3(minimum number of groups)
In this example, one optimal grouping is:
- Group 1: (1, 3)
- Group 2: (4, 4)
- Group 3: (7)
An alternative valid grouping could be:
- Group 1: (1)
- Group 2: (3, 4, 4)
- Group 3: (7)
In both cases, we form 3 groups, and this is the minimum number of groups that can be formed. There’s no way to form fewer than 3 groups given the maxSpread condition.
解题思路
排序技能水准:首先将学生的技能水准从小到大排序。 这样可以确保我们在遍历学生时,只需要关注相邻学生的技能差异。
贪心策略分组:遍历排序后的学生清单,尝试将每个学生放入当前组,直到当前组内的最大技能差异超过maxSpread。 如果超过了,就开始新的一组。
2. Linked List Creation
There is a singly linked list of n nodes. Each node is an instance of a SinglyLinkedListNode, which has an integer value data and a pointer to the next node, next. Perform the following operations to generate a new linked list:
- Select all the nodes at odd positions.
- Append these nodes to the new linked list, keeping them in their original order.
- Delete these nodes from the old linked list.
- Repeat from step 1 until there are no nodes left in the old linked list.
Return a reference to the head of the final linked list.
Note: Extra memory, other than creating some new nodes, should not be used for the implementation.
解题思路
定义链表节点结构:每个链表节点包含data(节点值)和next(指向下一个节点的指针)。
选取奇数位置节点:我们可以通过遍历链表来获取奇数位置的节点。 奇数位置的节点是指1、3、5等位置的节点。
修改指针链接:
从原链表中获取奇数位置的节点,并将它们逐一添加到新链表的末尾。
删除这些节点时,必须确保将原链表的前驱节点正确地指向下一个节点,避免断链。
重复操作:每次处理完奇数位置的节点后,需要跳过一个节点(即删除当前处理的节点的下一个节点),并继续执行此操作,直到链表为空。
3. String compression and decompression
Various compression methods are employed to minimize the size of messages transmitted over the internet. A specific algorithm compresses a given string by indicating the total number of consecutive occurrences of each character. For instance, one string "aabbaa" can be compressed as "a2b2a2". The characters of each character are grouped as follows:
aoccurs two times consecutively,boccurs two times consecutively,aoccurs two times consecutively.
If a character occurs only once, it is added to the compressed string. If it occurs consecutively, the character is added to the string followed by an integer representing the number of consecutive occurrences. Thus, the compressed form of the string is "a2b2a2".
Function Description:
Complete the function compressedString in the editor below. The function must return the compressed form of the message.
compressedString has the following parameter(s): message: a string.
Returns: string: the compressed message.
def compressedString(s):
# Write your code here
n = len(s)
ans = ""
i = 0
while i < n:
j = i + 1
while j < n and s[j] == s[i]:
j += 1
ans += s[i]
if j - i > 1:
ans += str(j - i)
i = j
return ans
解题思路是遍历字串,对于每个字符,统计其连续出现的次数,并将字符与次数合并生成压缩字串。
Learn More
Tsmc一畝三分地
台積電人才招聘
台積電面試懶人包:面試流程、面試問題 TSMC IT Careers

冲刺TSMC 却被HackerRank OA卡住,别慌!
我们专业团队专注台积电招聘全流程辅助,已帮助数百位候选人稳定通过第一关HackerRank,甚至直通现场/视频面试。服务覆盖全流程:HackerRank OA 代做 ;实时同步辅导;技术面试 1v1 模拟与真题训练;行为/HR 面试答案定制及代面服务,全程保密、专业、低调。凭借丰富经验和高成功率,我们的服务帮助大多数候选人顺利拿下 TSMC offer,成功率超过 95%。立即行动,把握机会,直通 TSMC!