第 8 周作业
next1 = 链表 1.header
Map<Value, Node> map = new HashMap<>;
while next1 不为空:
map.put(next1.value, next1)
next1 = next1.next
next2 = 链表 2.header
while next2 不为空:
if next2.value 在 map 中:
return map.get(next2.value)
next2 = next2.next
return null
next1 = 链表 1.header
Map<Value, Node> map = new HashMap<>;
while next1 不为空:
map.put(next1.value, next1)
next1 = next1.next
next2 = 链表 2.header
while next2 不为空:
if next2.value 在 map 中:
return map.get(next2.value)
next2 = next2.next
return null
评论