CS-OA cs-vo Faang

Tiktok VO 真题 – Tiktok 一亩三分地面经 – 面试代做 – OA代写

近期tiktok面试热度仍然不减,让我们一起来看看真实面试中真题的信息吧。Tiktok的面试是常规算法,40分钟需要做完2题,如下是其中的2题。

Question 1:

You are given two arrays with positive integers arr1 and arr2.

A prefix of a positive integer is an integer formed by one or more of its digits, starting from its leftmost digit. For example, 123 is a prefix of the integer 12345, while 234 is not.

A common prefix of two integers a and b is an integer c, such that c is a prefix of both a and b. For example, 5655359 and 56554 have a common prefix 565 while 1223 and 43456 do not have a common prefix.

You need to find the length of the longest common prefix between all pairs of integers (x,y)(x, y)(x,y) such that xxx belongs to arr1 and yyy belongs to arr2.

Return the length of the longest common prefix among all pairs. If no common prefix exists among them, return 0.

Example 1:

  • Input: arr1 = [1, 10, 100], arr2 = [1000]
  • Output: 3

Explanation: There are 3 pairs (arr1[i], arr2[j]):

  • The longest common prefix of (1, 1000) is 1.
  • The longest common prefix of (10, 1000) is 10.
  • The longest common prefix of (100, 1000) is 100. The longest common prefix is 100 with a length of 3.

Question 2:

You are given a 0-indexed array nums and an integer target. A 0-indexed array infinite_nums is generated by infinitely appending the elements of nums to itself.

Return the length of the shortest subarray of the array infinite_nums with a sum equal to target. If there is no such subarray return -1.

Example 1:

  • Input: nums = [1, 2, 3], target = 5
  • Output: 2

Explanation: In this example infinite_nums = [1, 2, 3, 1, 2, 3, 1, 2, ...]. The subarray in the range [1, 2] has the sum equal to target = 5 and length = 2. It can be proven that 2 is the shortest length of a subarray with sum equal to target = 5.

Example 2:

  • Input: nums = [1, 1, 1, 2, 3], target = 4
  • Output: 2

Explanation: In this example infinite_nums = [1, 1, 1, 2, 3, 1, 1, 1, 2, 3, ...]. The subarray in the range [4, 5] has the sum equal to target = 4 and length = 2. It can be proven that 2 is the shortest length of a subarray with sum equal to target = 4.

Example 3:

  • Input: nums = [2, 4, 6, 8], target = 3
  • Output: -1

Explanation: In this example infinite_nums = [2, 4, 6, 8, 2, 4, 6, 8, ...]. It can be proven that there is no subarray with sum equal to target = 3.

总结

面试结束后,客户对我们辅助的面试表现感到满意。通过这次面试辅助服务,客户不仅向面试官展示了自己的算法能力和编码水平,还在与面试官的交流中学习到了新的优化思路和技巧。TikTok 的面试题目设计得很有挑战性,但也非常贴近实际应用。

希望这篇面经对未来准备 TikTok 面试的同学们有所帮助!

经常有同学会问我们,面试辅助和代面试有什么区别。在这里统一回答一下,面试辅助专注于解决面试中的技术问题,换言之如果你仅有技术是短板,其他方面非常擅长沟通面试的话,选择面试辅助是比较好的选择。

而代面试则更适合那些对自己各方面都不太自信的同学。扫码添加我的微信,欢迎随时联系我

Leave a Reply

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