Tell me how you would find the longest consecutive range in an array.
Implement the solution for an unsorted integer array. Return the inclusive range as [start, end]; duplicate values do not extend a range. If multiple ranges have the same length, return the one with the smallest start value. Return [] for an empty array.
Function signature: def longest_consecutive_range(nums):
def longest_consecutive_range(nums):