You are given two integers height and width representing a grid of size height $ imes$ width. You are also given an integer array tree of length squirrel of length nuts where each nuts[i] represents the coordinates of a nut.
The squirrel can carry at most
Return the minimum total distance the squirrel must travel to collect all the nuts and bring them to the tree one by one.
Constraints:
height, width
tree.length
squirrel.length
nuts.length
nuts[i].length
tree_r, squirrel_r, nut_{ir} height
tree_c, squirrel_c, nut_{ic} width
You are given two integers height and width representing a grid of size height $ imes$ width. You are also given an integer array tree of length squirrel of length nuts where each nuts[i] represents the coordinates of a nut.
The squirrel can carry at most
Return the minimum total distance the squirrel must travel to collect all the nuts and bring them to the tree one by one.
Constraints:
height, width
tree.length
squirrel.length
nuts.length
nuts[i].length
tree_r, squirrel_r, nut_{ir} height
tree_c, squirrel_c, nut_{ic} width