input: from typing import List
  
  def longest_monotonic_subarray_length(nums: List[int]) -> int:
      """
      Given an array of integers nums, return the length of the longest subarray that is either strictly increasing or strictly decreasing.
      
      Examples:
      >>> nums = [1, 4, 3, 3, 2]
      2
      
      >>> nums = [3, 3, 3, 3]
      1
      
      >>> nums = [3, 2, 1]
      3
      
      Constraints:
      1 <= len(nums) <= 50
      1 <= nums[i] <= 50
      """
output:     if not nums:
          return 0
      
      longest = 1
      current_length = 1
      increasing = None
  
      for i in range(1, len(nums)):
          if nums[i] > nums[i - 1]:
              if increasing is False:
                  current_length = 1
              current_length += 1
              increasing = True
          elif nums[i] < nums[i - 1]:
              if increasing is True:
                  current_length = 1
              current_length += 1
              increasing = False
          else:
              current_length = 1
              increasing = None
          
          longest = max(longest, current_length)
  
      return longest