Partition Value Finder

You are given a 0-indexed integer array nums. Partition it into two non-empty arrays such that every element belongs to exactly one part. The partition value is the absolute difference between the maximum of one part and the minimum of the other part. Either group may play either role. Return the minimum possible partition value.

Examples
Input: [1,3,2,4]
Output: 1
Hints

Partition Value Finder

You are given a 0-indexed integer array nums. Partition it into two non-empty arrays such that every element belongs to exactly one part. The partition value is the absolute difference between the maximum of one part and the minimum of the other part. Either group may play either role. Return the minimum possible partition value.