<think>
Okay, I need to fix the pick_upgrade function according to the problem description. Let me start by understanding the current code and the issues mentioned.

The problem says that the current pick_upgrade function returns the last qualifying offer instead of the newest one. Also, it treats the installed build as an upgrade and doesn't validate the input properly. So, I need to correct these issues.

First, the compare_builds function is supposed to compare builds correctly. The current code for compare_builds seems correct, so I should leave that as is. But the pick_upgrade function needs to be fixed.

The main issues in pick_upgrade are:

1. It should return the newest offer, not the last one. So, instead of keeping the last one, we need to find the maximum valid offer.
2. It should not consider the installed build as an upgrade. So, the comparison should be strictly greater than the installed build.
3. Validate the inputs: check that installed and each offer are strings in the correct dotted format. Also, ensure that offers is a list.

So, the steps to fix:

- In pick_upgrade, first validate the inputs. Check if installed is a string, offers is a list. Also, check that each offer is a valid build string (no leading zeros, etc.).
- Then, for each offer, check if it has the same leading number as the installed build.
- Compare the offer to the installed build using compare_builds. If it's strictly greater, then it's a candidate.
- Among all candidates, select the one with the highest version number.

Wait, how to find the newest offer? The current code uses a loop and sets best to the first valid offer, but that's not correct. We need to find the maximum valid offer. So, perhaps we can track the best candidate by comparing each valid offer with the current best.

So, in the loop, for each offer that meets the criteria (same leading number and strictly greater), compare it with the current best. If it's newer, update the best.

But how to compare? The compare_builds function returns 1 if a is newer than b. So, for each valid offer, compare it with the current best. If it's newer, replace the best.

But initially, best is None. So, for the first valid offer, best is set to it. Then, for subsequent offers, if they are newer, replace best.

So, the code should be:

Initialize best as None.

For each offer in offers:

   if the offer is invalid, skip.

   if the leading number is different, skip.

   if compare_builds(offer, installed) > 0:

       if best is None or compare_builds(offer, best) > 0:

           best = offer

So, this way, the best is the newest one.

Also, need to validate the installed and each offer. How to check if a string is a valid build? The problem says that builds are decimal numbers joined by dots, no leading zeros. So, each part must be a non-zero integer (except maybe the first part? Wait, no. The problem says "no leading zeros". So, for example, "01.2" is invalid because of leading zero in the first part. But "2.10" is valid.

So, to validate a build string, each part must be a string that represents a non-negative integer, and no part can have leading zeros unless it's exactly "0".

So, for each part in the split string, check that it's a valid integer, and that if the part is more than one character, it doesn't start with a zero.

So, the validation function for a build string would be:

def is_valid_build