Tiktok OA 1.25 – 1.29
  1. Similar Passwords

TikTok is exploring a creative new method for authentication, designed to help users who often forget their exact passwords. Instead of requiring an exact match, TikTok now evaluates whether a password attempt is similar to the user's stored password based on specific rules.

A password attempt (attempt) is considered similar to the stored password (stored) if it satisfies one of the following conditions:

  1. If attempt matches stored exactly, it is considered similar.
  2. If attempt and stored are both of the same even length:
    • Split attempt from middle into two equal halves: attempt1 and attempt2.
    • Split stored from middle into two equal halves: stored1 and stored2.
    The passwords are similar if either:
    • attempt1 is similar to stored1 and attempt2 is similar to stored2, or
    • attempt1 is similar to stored2 and attempt2 is similar to stored1.

This similarity check is applied recursively whenever a split occurs.

Note: If the lengths of attempt and stored differ or are odd, the split rule cannot be applied.


  1. Viral Content Pathways

TikTok has a collection of content categories, each connected by recommendation links that guide users from one category to another.

There are category_nodes content categories numbered from 0 to category_nodes - 1. The network of content categories and links forms an undirected tree with category_nodes number of nodes and (category_nodes - 1) number of edges. Each recommendation link has a "viral potential," denoted by viral_val[i], which can either be 0 or 1.

More formally, the overall network is represented as follows:

  • category_nodes: the number of content categories
  • category_from, category_to: arrays representing an undirected link between category_from[i] and category_to[i] for 1 ≤ i ≤ (category_nodes - 1)
  • viral_val[i]: the viral potential of each recommendation link in the network, which can be either 0 or 1

Given an integer category_nodes and the network of content categories and recommendation links and the viral potential array.

The task is to count the number of recommendation sequences of length k denoted as:
[r[1], r[2], ..., r[k]], where 0 ≤ r[i] ≤ category_nodes - 1 for 1 ≤ i ≤ k, such that the traversal along the shortest paths between consecutive categories starting from r[1] till r[k] must include at least 1 recommendation link with a viral potential = 1 across the entire journey.

More formally,


我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *