架构师训练营 week08 homework
复制代码
时间复杂度:O(m+n)
空间复杂度:O(1)
50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi
public ListNode findFisrtCommonNode(ListNode head1, ListNode head2)
{
ListNode current = head1;
while (head1.Next != null){
current = head1;
head1 = head1.Next;
current.Next = null;
}
while (head2.Next != null) head2 = head2.Next;
return head2;
}
时间复杂度:O(m+n)
空间复杂度:O(1)
50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi50zi
还未添加个人签名 2018.05.01 加入
还未添加个人简介
促进软件开发及相关领域知识与创新的传播
评论