</>OfferRetriever
DashboardDiscuss
NEW

July 4th Sale

Limited Time Deal: Unlock all premium questions for over 40% off

$10.42$6.25

10

:

09

:

27

:

54

Get this deal
Back to Dashboard

Closest Value Pair

Medium

An inventory system has two sorted product catalogs A and B. Each value in the catalog represents a product size. Find a pair [a, b] where a comes from catalog A and b comes from catalog B such that the absolute size difference |a - b| is minimized.

If multiple pairs achieve the same minimum difference, return the one with the smallest a. If there is still a tie on a, return the one with the smallest b. ...