Search⌘ K
AI Features

Rearranging Fruits

Rearranging Fruits gives two fruit-cost arrays and permits cross-basket swaps priced by the cheaper fruit; return the minimum cost to make their sorted contents identical, or -1 if impossible.

Statement

Given two 0-indexed integer arrays, basket1 and basket2, representing the cost of each fruit in the basket. Each ...