Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2024-09-10 00:19:43
三天都写一写
写得满手是血
我好烂...姆咪...
def dfs(self, head, root):
if head is None:
return True
if root is None:
return False
if head.val == root.val:
return self.dfs(head.next, root.left) or self.dfs(head.next,
root.right)
else:
return False
def isSubPath(self, head: Optional[ListNode], root: Optional[TreeNode]) ->
bool:
if root is None:
return False
elif self.dfs(head,root):
return True
else:
return self.isSubPath(head,root.left) or
self.isSubPath(head,root.right)
作者: JIWP (JIWP)   2024-09-10 00:20:00
大师
作者: oin1104 (是oin的说)   2024-09-10 00:21:00
大师
作者: dont   2024-09-10 01:08:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com