Analysis of the latest three questions of TikTok OA North America|CodeSignal Detailed explanation of the real test ideas

41 Views
No Comment

Recent TikTok OA here in North America is indeed very intensive. I have done several sessions during this period, and the overall format is still CodeSignal. The physical feeling is: the hit rate of the original question is not low, but the hand must be steady. The pace is fast and there are many implementation details. If you fail to write a corner case, you will easily lose points. This time I have compiled the core ideas of the three questions to serve as a reference for students preparing for TikTok OA.

Analysis of the latest three questions of TikTok OA North America|CodeSignal Detailed explanation of the real test ideas

Q1: Dynamic statistics of adjacent pairs of the same color

You are given a number line of length length, initially all zeros. Each operation gives [coord, color], change the position to a certain color (overwriting the original value). After each operation, output how many pairs of adjacent positions there are currently (i, i+1) Same color.

Idea:A modification will only affect the relationship between this point and the left and right positions, so there is no need to traverse it all every time. Maintain a current count of adjacent pairs of the same color. Before modifying, first subtract it from the possible pairs of the same color on the left and right; after changing the color, judge whether a new pair of the same color is formed and add it. Each operation only changes part of it, and the whole is the answer to dynamic maintenance.

Q2: Graphic placement simulation

Give several shape graphics: they cannot be rotated or overlapped. Every time you place a graphic, you must select the legal position with the smallest row number and smallest column number, and finally output the entire grid state.

The idea is pure simulation. For each graphic, starting from the upper left corner, the possible upper left corner positions are enumerated row by row to determine whether it crosses the boundary and conflicts with existing graphics. Just put it in the first legal position you find, and then move on to the next shape.

Q3: Vowels at the beginning and end of words are reversed in the middle

Given an array of strings Text, processing the words one by one. The rule is: if the first and last letters of a word are both vowels (a, e, i, o, u, both upper and lower case), only flip the middle section of characters and keep the first and last letters unchanged; otherwise, output them as they are.

Idea: Traverse each word and first determine whether the first and last characters are vowels. If not, just add the result as it is; if it is, take the middle part word[1:-1] and do a reversal, and then spell it into a new word = first letter + reversed middle + last letter. Words whose length is less than or equal to 2 are actually the same whether they are translated or not, and can be retained directly.

High-intensity practical support

If you are not sure about TikTok OA or other online written examinations from major North American companies, we also provide OA 无痕联机辅助服务 , whether it is CodeSignal, HackerRank or various customized platforms, they are all supported by mature experience. It’s not that many students don’t know how to do it, but their performance on the spot is unstable—it’s often more effective to follow the actual rhythm in advance than to blindly answer questions.

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END
 0