字节跳动tiktok OA面经

更多资源与服务

想要了解更多编程面试技巧,或者需要专业的面试辅导OA代做简历润色等服务?我们提供全方位的求职面试支持,帮助您在大厂面试真题系统设计面试算法面试中脱颖而出,轻松拿到心仪的 offer!无论您是留学生、刚踏入职场的新人,还是需要代码优化建议的开发者,我们的团队由ACM奖牌得主、大厂资深 TLM 及经验丰富的行业老兵组成,确保为您提供最专业的指导。

扫描下方二维码,添加我们的微信,获取更多服务:

微信二维码

关键词:

  • 面试代面
  • 代码代写
  • OA代做
  • 面试技巧
  • 面试经验分享
  • 职业规划
  • 编程练习

让我们帮助您在技术面试中脱颖而出,实现职业上的飞跃!

Question 1: Maximizing Efficiency Product

Description:

Given a list of efficiency scores, implement a function to calculate the maximum possible product by choosing five scores from the list. You may select any combination of the top five scores or mix with the lowest values, aiming to maximize the product.

Input:

  • efficiencyScores (List[int]): List of integer efficiency scores.

Output:

  • Returns an integer representing the maximum product obtainable with five chosen scores.

Code Example:

def maximizeEfficiencyProduct(efficiencyScores):
    efficiencyScores.sort()
    res = 1
    for i in range(5):
        res = res * efficiencyScores[-1-i]
    for i in range(6):
        cur = 1
        for ii in range(i):
            cur = cur * efficiencyScores[ii]
        for ii in range(5-i):
            cur = cur * efficiencyScores[-1-ii]
        res = max(res, cur)
    return res

Question 2: Getting Secondary Influencer Sum

Description:

Given a social network represented as an undirected graph, calculate the sum of all nodes that are secondarily influential. A node is secondarily influential if it has significant influence on the network, but it is not the most influential node.

This function calculates the maximum depth from a given root and computes the sum of nodes that meet the secondary influence criteria.

Input:

  • g_nodes (int): Number of nodes in the graph.
  • g_from, g_to (List[int]): Lists representing edges between nodes in the graph.

Output:

  • Returns an integer sum of secondary influencer nodes.

Code Example:

def getSecondaryInfluencerSum(g_nodes, g_from, g_to):
    root = 1
    g = {}
    mxd = {}
    for u, v in zip(g_from, g_to):
        if u not in g:
            g[u] = set()
        if v not in g:
            g[v] = set()
        g[u].add(v)
        g[v].add(u)
    mx = maxD(g, 1, 0, mxd)[0]
    return secondMaxD(g, 1, 0, 0, mx, mxd)

Question 3: Sorting Social Media Feed

Description:

Given a social media feed represented as a list of strings, each with an ID and timestamp, implement a function to sort the feed based on timestamp, and then by ID in case of ties.

Input:

  • feed (List[str]): A list of strings where each entry represents a post ID and timestamp separated by a comma.

Output:

  • Returns a sorted list based on timestamp and then ID.

Code Example:

def sortSocialMediaFeed(feed):
    feed.sort(key=lambda x: (x.split(',')[1], int(x.split(',')[0])))
    return feed