📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
查看: 3086| 回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

[找工就业] Doordash 店面

全局:

2023(10-12月)-CS硕士+1-3年 | 网上海投|BayArea湾区 码农类General全职@doordash

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
# 5 min 自我介绍

# Questions:. 1point 3 acres
. ----
#     major coding language: Java Python
#     Active interviewing, No hard dealine
#     Now in bay area!!!
#     H1b visa Oct 2023, I-140

# Role:

#     SDE 2 / L4 .google  и
#     Infra -- Remote, work. .и
#     Compute, K8s, traffic
#     Traffic team

# Interview Rounds:

#     1 coding + 1 debugging. .и
#     3-4 interviews, team hiring, on-site(remote)


# Software Engineer, Compute, . ----

# 2+ years of experience in Infrastructure and/or Platform, experience with (GCP, AWS, AZURE ..).--


################
# ```Python
# // Given a binary tree, find the maximum path sum from any two "alive nodes" within the tree. We can assume a node is an alive node if and only if it is a leaf node, indicated by an asterisk below.. 1point 3 acres

# // Example 1
. ----
# // Input

# //              5
# //            /    \  
# //          2       0 ..
# //         /       /  \
# //       *25      *14  *15
. 1point 3 acres
# // Output:
.1point3acres
# // 47 = 25 + 2 + 5 + 15
# // Example 2.--

# // Input

# //              5
# //            /    \  
# //          2       0
# //         /  \     / \
# //       *100 *50  *4 *15
# // Output:

# // 152 = 100 + 2 + 50

# */

# // Input

# //              5
# //            /    \  
# //          2*       0
# //         /  \     / \
# //       100*  50* 4*  15*

# // Output: 102

# 5 - 2 - 100
#       - 50

# // We can see we don't include 50 here because 2* is an alive node and must be at the end of a path.
# // 100 + 2 = 102

class TreeNode:
    def __init__(self, val=0, left=None, right=None, isStar=False):
        self.val = val
        self.left = left. Waral dи,
        self.right = right
        self.isStar = isStar

class Solution:
    def findMaxPathSum(self, root: TreeNode):
        # pass in tree root node, return max sum ..
        self.max_sum = float('-inf')

        def dfs(node: TreeNode):
            # check if curr node isStar.
            if not node:
                return [0, 0]
            if not node.left and not node.right:
                return [node.val, 0]

            # compute left and right path sum recursively            
            left_sum, left_dead_sum = dfs(node.left)
            right_sum, right_dead_sum = dfs(node.right)

            node_sum = node.val + max(left_sum, 0) + max(right_sum, 0)
            node_dead_sum = max(left_dead_sum, 0) + max(right_dead_sum, 0)
. Waral dи,
            # update self.max_sum
            self.max_sum = max(self.max_sum, node_sum, node_dead_sum)
            if node.isStar:. .и


            return [node.val + max(max(left_sum, right_sum), 0), max(left_dead_sum, right_dead_sum)]

        dfs(root)
        return self.max_sum
. 1point3acres.com
# //              5
# //            /    \  
# //          2       0
# //         /  \     / \
# //       *100 *50  *4 *15
root = TreeNode(5, TreeNode(2, TreeNode(100, None, None), TreeNode(50, None, None)), TreeNode(0, TreeNode(4, None, None), TreeNode(15, None, None)) )
print(Solution().findMaxPathSum(root))
```

评分

参与人数 1大米 +2 收起 理由
Bearleo + 2 很有用的信息!

查看全部评分


上一篇:微软2024 Summer DS Intern Timeline
下一篇:meta店面
🔗
wqhh 2024-3-1 14:03:09 | 只看该作者
全局:
楼主,可以麻烦问一下onsite都面了哪些吗?谢谢!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表