There's a tree, a squirrel, and several nuts. Positions are represented by the cells in a 2D grid. Your goal is to find the **minimal** distance for the squirrel to collect all the nuts and put them under the tree one by one. The squirrel can only take at most **one nut** at one time and can move in four directions - up, down, left and right, to the adjacent cell. The distance is represented by the number of moves.

**Example 1:**

Input:Height : 5 Width : 7 Tree position : [2,2] Squirrel : [4,4] Nuts : [[3,0], [2,5]]Output:12Explanation:

**Note:**

- All given positions won't overlap.
- The squirrel can take at most one nut at one time.
- The given positions of nuts have no order.
- Height and width are positive integers. 3 <= height * width <= 10,000.
- The given positions contain at least one nut, only one tree and one squirrel.

```
struct Solution;
impl Solution {
fn min_distance(
_: i32,
_: i32,
tree: Vec<i32>,
squirrel: Vec<i32>,
nuts: Vec<Vec<i32>>,
) -> i32 {
let mut sum = 0;
let mut diff = std::i32::MIN;
for nut in nuts {
let t = Self::dist(&nut, &tree);
let s = Self::dist(&nut, &squirrel);
sum += t * 2;
diff = diff.max(t - s);
}
sum - diff
}
fn dist(a: &[i32], b: &[i32]) -> i32 {
(a[0] - b[0]).abs() + (a[1] - b[1]).abs()
}
}
#[test]
fn test() {
let tree = vec![2, 2];
let squirrle = vec![4, 4];
let nuts = vec_vec_i32![[3, 0], [2, 5]];
let res = 12;
assert_eq!(Solution::min_distance(0, 0, tree, squirrle, nuts), res);
}
```