Search⌘ K
AI Features

Rearranging Fruits

Rearranging Fruits asks you to make two fruit-cost arrays identical after sorting by swapping elements across baskets, paying the smaller cost each time, and return the minimum total or -1 if impossible.

Statement

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