TikTok 26NG OA latest real question in March|CodeSignal four questions easily won

127 Views
No Comment

Recently, I’ve been helping students with several TikTok 26NG OAs, and this one went very smoothly overall. The question types followed the usual familiar patterns, with basically no new twists. If you’ve previously done TikTok or similar companies’ OAs, it’s easy to get into a state where you immediately know how to write the solution as soon as you see the problem. This time, there were four questions on CodeSignal, and the whole process progressed very smoothly—everything could be completed in just over ten minutes.

TikTok 26NG OA latest real question in March|CodeSignal four questions easily won

Overview of TikTok 26NG OA

Platform: CodeSignal
Number of questions: 4
Duration: typically 70–90 minutes
Difficulty: Easy – Medium (leaning toward Easy)

Real TikTok 26NG OA Questions Sharing

Drone Delivery Walking Distance Calculation

Title Description

You need to deliver a package from position 0 to the target location target, with several charging stations stations along the way. The delivery rules are as follows:

  1. Find the nearest charging station ahead. If there is no charging station, walk the package to the target location.
  2. Dispatch a fully charged drone from that charging station to carry the package as far as possible toward the target.
  3. If the target has not been reached, walk to the drone’s landing point to retrieve the package and repeat Step 1.

Calculate the total distance you walk while delivering the package.

ExampleNone provided

  • Input: target = 23, stations = [7, 4, 14] → Output: 4 Explanation: Start from 0 and walk to the nearest charging station ahead, which is 4 (distance 4). A drone is then dispatched from 4 and flies as far as possible toward the target, reaching 14. From 14, another drone is dispatched and reaches 23 directly. Therefore, the total walking distance is 4.
  • Input: target = 27, stations = [15, 7, 3, 10] → Output: 7 Explanation: Start from 0 and walk to the nearest charging station ahead, which is 3 (distance 3). A drone is dispatched from 3 and flies as far as possible, reaching 13. From 13, walk to the nearest charging station ahead, which is 15 (distance 2). A drone is then dispatched from 15 and flies directly to 27. Therefore, the total walking distance is 3 + 2 = 5.

Approach to Solving Problems

T2: You start at 0 and need to reach target. Along the way, you can make use of certain points p[i], and from p[i] you can move directly to p[i] + 10. What you need to calculate is the actual total walking distance, meaning the parts skipped by using these “jump points” do not count. A greedy approach works well here: first sort the points, then in each round find a usable point that lies ahead of your current position. Add the distance from your current position to that point to the answer, then update your current position to p[i] + 10. Keep repeating this process until you reach or pass target. The idea is simply to simulate the process, always greedily choosing the next available usable point.

Newspaper Layout Justification

Title Description

You are a newspaper layout editor and need to format the text according to the given requirements:

  • paragraphs: an array of paragraphs, where each paragraph is an array of words.
  • aligns: an array of alignment modes, where each element is either "LEFT" or "RIGHT".
  • width: the maximum number of characters per line (excluding the border).

Formatting rules:

  1. Words in each paragraph are arranged in order, separated by spaces.
  2. Put as many words as possible on each line (with total length ≤ width); if the next word does not fit, wrap to a new line.
  3. Extra spaces should be handled according to the alignment mode: for LEFT, pad spaces at the end of the line; for RIGHT, pad spaces at the beginning.
  4. The final output should be wrapped with a border of * characters, and the border does not count toward width.

Return the formatted newspaper page as an array of strings.

Approach to Solving Problems

Sort and format the words according to the required output rules. For each group of words, maintain the current line length and use a two-pointer approach to iterate through the words, appending them to the current line as long as they fit. If the next word cannot fit, start a new line. When generating the final output, adjust each line according to the specified alignment mode in the problem—either left-aligned or right-aligned.

Most Similar Pair of Mountain Heights

Title Description

A climber can only compare mountains whose positions are at least viewingGap apart. Among all mountain pairs satisfying |a - b| >= viewingGap, find the pair with the smallest height difference and return that minimum difference.

ExampleNone provided

  • Input: heights = [1, 5, 4, 10, 9], viewingGap = 3 → Output: 4 Valid pairs: (0,3) → difference = 9, (0,4) → difference = 8, (1,4) → difference = 4 → minimum difference = 4.
  • Input: heights = [3, 10, 5, 8], viewingGap = 1 → Output: 2 All pairs can be compared. The minimum difference is 2 (e.g., between 3 and 5, or 5 and 8).

Approach to Solving Problems

Under the condition that |a - b| >= lim, the goal is to find the minimum possible difference. A suitable approach is to scan from left to right, use discretization together with a Fenwick tree to maintain the heights that have already appeared, and for each current height, use binary search to find its predecessor and successor. Then check the valid candidates to update the minimum difference.

Using Backup Batteries for a Mobile Phone

Title DescriptionNone provided

The phone needs to stay powered on continuously for t minutes. Backup batteries are used in cyclic order: after a battery is used for capacity[i] minutes, it is depleted and must be recharged for recharge[i] minutes before it can be used again. If at any point all batteries are recharging, return -1; otherwise, return the number of batteries that are fully used within the t-minute period.

ExampleNone provided

  • Input: t = 16, capacity = [2, 5, 6], recharge = [12, 1, 4] → Output: 3 Process: Use battery 0 for 2 minutes, then switch to the next available battery, then use battery 1 for 5 minutes, then battery 2 for 6 minutes. By that time, battery 0 has finished recharging, so it can be used again to continue running until 16 minutes. In total, 3 batteries are counted as fully used.

Approach to Solving Problems

You just simulate the batteries being used in rotation until time t, then count how many batteries were actually used. Maintain the next time position at which each battery becomes fully charged again, and keep looking for the next valid battery from the current time onward. If a battery can cover all of the remaining time, then that battery should not be counted in the total.

TikTok OA 建议

Although the overall difficulty of the TikTok OA is not high, many students take it at critical moments—for example, handling multiple OAs at the same time, aiming for a return offer where mistakes are not acceptable, or being in an unstable state on the day and easily making coding errors. In these situations, consistency in performance becomes extremely important. Having real-time guidance can make things much easier—for instance, helping you quickly identify the right direction, or getting you back on track promptly if you start going off course, saving valuable time. OA traceless assist You can usually handle three to four sessions per week. The question bank and patterns are quite stable. If you want more consistency in your performance and a safety net during the exam, it’s worth checking out.

author avatar
Jory Wang (Note: No direct translation is provided as this appears to be a name) Senior Software Developer at Amazon
Senior Amazon Engineer with extensive experience in the development of core systems for infrastructure, specializing in scalability, reliability, and cost optimization. Currently focusing on FAANG SDE interview preparation, helping over 30 candidates secure L5/L6 offers within a year.
END
 0