</>OfferRetriever
DashboardDiscuss
NEW

Spring Hire Sale

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

$10.42$7.08

08

:

04

:

49

:

00

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. ...