Photo by Pawel Czerwinski on Unsplash1509. Minimum Difference Between Largest and Smallest Value in Three MovesTapan Rachchh·Jul 3, 2024·1 min readclass Solution: def minDifference(self, nums: List[int]) -> int: n = len(nums) if n <= 4: return 0 nums.sort() ans = float('inf') for i in range(4): a = nums[i] b = nums[-4 + i] ans = min(ans, b - a) return ans Pythonleetcodearray Share this