Search⌘ K
AI Features

Rearranging Fruits

Rearranging Fruits lets you swap fruits between two cost arrays, paying the cheaper fruit in each swap. Return the minimum cost to make their sorted contents match, or -1 if impossible.

Statement

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