关于无薪假的问题# EB23 - 劳工卡
e*s
1 楼
Two reverse sorted arrays A and B have been given, such that size of A is m
and size of B is n
You need to find the k th largest sum (a+b) where a is taken from A and b is
taken from B.
看了好多论坛上的答案,好像都不是很清楚。 有一个用max-heap做的,就是每次从
heap里pop出一个
pair(a[i]+b[j]),然后将 pair(a[i],b[j+1]) 和pair(a[i+1],b[j]) insert到heap里。
但好像需要check是不是重复的pair(a[i],b[j])已经在heap里了。 不知道有没有人有
更清楚的解
法,多谢。
and size of B is n
You need to find the k th largest sum (a+b) where a is taken from A and b is
taken from B.
看了好多论坛上的答案,好像都不是很清楚。 有一个用max-heap做的,就是每次从
heap里pop出一个
pair(a[i]+b[j]),然后将 pair(a[i],b[j+1]) 和pair(a[i+1],b[j]) insert到heap里。
但好像需要check是不是重复的pair(a[i],b[j])已经在heap里了。 不知道有没有人有
更清楚的解
法,多谢。