Author |
Topic: Maximum Sums (Read 772 times) |
|
mad
Junior Member
Posts: 118
|
|
Maximum Sums
« on: Mar 8th, 2008, 5:59am » |
Quote Modify
|
Given two sorted postive integer arrays A(n) and B(n) sorted in decreasing order , we define a set S = {(a,b) | a in A and b in B}. Obviously there are n^2 elements in S. The value of such a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs from S with largest values using an O(n) algorithm.
|
|
IP Logged |
|
|
|
Aryabhatta
Uberpuzzler
Gender:
Posts: 1321
|
|
Re: Maximum Sums
« Reply #1 on: Mar 8th, 2008, 11:06am » |
Quote Modify
|
I believe this is already there on this forum somewhere. Perhaps under a title similar to "The hardest interview question ever"
|
|
IP Logged |
|
|
|
mad
Junior Member
Posts: 118
|
|
Re: Maximum Sums
« Reply #2 on: Mar 8th, 2008, 4:36pm » |
Quote Modify
|
I am unable to locate a link. Tried searching, but it is showing this post only again. Could you please provide a link?
|
|
IP Logged |
|
|
|
|