title: Smallest Difference Pair Values Two Unsorted Arrays
signature: def smallest_difference_pair_values_two_unsorted_arrays(a, b, m, n):
source_py: def smallest_difference_pair_values_two_unsorted_arrays(A, B, m, n):
      A.sort()
      B.sort()
      a = 0
      b = 0
      result = sys.maxsize
      while ((a < m) and (b < n)):
          if (abs((A[a] - B[b])) < result):
              result = abs((A[a] - B[b]))
          if (A[a] < B[b]):
              a += 1
          else:
              b += 1
      return result
source_cpp: int smallest_difference_pair_values_two_unsorted_arrays(vector<int> A, vector<int> B, int m, int n) {
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    int a = 0, b = 0;
    int result = INT_MAX;
    while ( a < m && b < n ) {
      if ( abs ( A [ a ] - B [ b ] ) < result ) result = abs ( A [ a ] - B [ b ] );
      if ( A [ a ] < B [ b ] ) a ++;
      else b ++;
    }
    return result;
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(a, b, m, n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              a, b, m, n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver([2, 2, 11, 13, 18, 18, 23, 25, 28, 28, 37, 39, 53, 56, 67, 70, 74, 74, 75, 79, 80, 82, 84, 89, 94, 95, 95, 98, 98], [5, 6, 11, 13, 13, 16, 17, 19, 23, 25, 28, 31, 31, 39, 41, 44, 45, 52, 62, 64, 70, 71, 73, 78, 78, 79, 85, 86, 92], 28, 14, 0)
      print(f"TEST-0...{result}")
  
      result = driver([-94, -78, -78, -72, -72, -72, -70, -70, -64, -62, -50, -48, -48, -44, -44, -40, -36, -36, -30, -24, -24, -22, -12, -10, -8, -4, -4, 0, 6, 10, 22, 30, 38, 56, 62, 72, 86], [-98, -98, -90, -84, -80, -78, -68, -62, -52, -50, -42, -30, -26, -24, -24, -24, -12, 2, 10, 14, 18, 22, 26, 26, 36, 42, 50, 60, 62, 64, 64, 72, 76, 78, 84, 86, 92], 23, 33, 0)
      print(f"TEST-1...{result}")
  
      result = driver([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14, 16, 0)
      print(f"TEST-2...{result}")
  
      result = driver([2, 9, 15, 24, 28, 28, 39, 47, 57, 61, 71, 82, 90], [11, 26, 27, 41, 47, 49, 51, 54, 70, 77, 84, 85, 92], 7, 8, 1)
      print(f"TEST-3...{result}")
  
      result = driver([-92, -90, -90, -28, -16, -14, -14, -8, 42, 52, 62, 84], [-98, -98, -58, -6, 14, 16, 18, 46, 52, 52, 52, 56], 11, 6, 2)
      print(f"TEST-4...{result}")
  
      result = driver([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 35, 33, 0)
      print(f"TEST-5...{result}")
  
      result = driver([6, 7, 7, 12, 15, 15, 21, 24, 26, 26, 28, 36, 38, 42, 46, 52, 55, 56, 59, 62, 63, 65, 65, 66, 68, 71, 73, 77, 77, 77, 77, 85, 87, 87, 88, 90, 93, 94, 98], [1, 3, 4, 4, 6, 7, 8, 8, 15, 17, 18, 18, 20, 23, 23, 24, 25, 25, 26, 33, 39, 43, 46, 54, 59, 67, 69, 69, 69, 69, 76, 76, 81, 81, 85, 86, 86, 91, 95], 30, 20, 0)
      print(f"TEST-6...{result}")
  
      result = driver([-82, -68, -68, -60, -60, -38, -20, -16, 4, 18, 18, 22, 24, 30, 34, 44, 70, 78, 88, 90, 94], [-74, -68, -64, -62, -60, -52, -50, -44, -36, -34, -32, -30, -20, -18, -14, -2, 18, 62, 62, 84, 98], 16, 12, 0)
      print(f"TEST-7...{result}")
  
      result = driver([0, 0, 1], [0, 0, 1], 2, 1, 0)
      print(f"TEST-8...{result}")
  
      result = driver([2, 7, 7, 9, 14, 15, 16, 20, 21, 26, 35, 37, 40, 45, 46, 47, 53, 56, 58, 61, 62, 67, 70, 70, 71, 73, 81, 85, 85, 90, 94, 98, 99], [1, 7, 14, 16, 18, 19, 24, 27, 28, 29, 29, 37, 41, 44, 45, 48, 49, 55, 64, 67, 67, 71, 72, 79, 80, 84, 86, 88, 88, 92, 94, 98, 99], 20, 25, 0)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: smallest_difference_pair_values_two_unsorted_arrays
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"a": [2, 2, 11, 13, 18, 18, 23, 25, 28, 28, 37, 39, 53, 56, 67, 70, 74, 74, 75, 79, 80, 82, 84, 89, 94, 95, 95, 98, 98], "b": [5, 6, 11, 13, 13, 16, 17, 19, 23, 25, 28, 31, 31, 39, 41, 44, 45, 52, 62, 64, 70, 71, 73, 78, 78, 79, 85, 86, 92], "m": 28, "n": 14}}, {"idx": 1, "outputs": 0, "inputs": {"a": [-94, -78, -78, -72, -72, -72, -70, -70, -64, -62, -50, -48, -48, -44, -44, -40, -36, -36, -30, -24, -24, -22, -12, -10, -8, -4, -4, 0, 6, 10, 22, 30, 38, 56, 62, 72, 86], "b": [-98, -98, -90, -84, -80, -78, -68, -62, -52, -50, -42, -30, -26, -24, -24, -24, -12, 2, 10, 14, 18, 22, 26, 26, 36, 42, 50, 60, 62, 64, 64, 72, 76, 78, 84, 86, 92], "m": 23, "n": 33}}, {"idx": 2, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "b": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "m": 14, "n": 16}}, {"idx": 3, "outputs": 1, "inputs": {"a": [2, 9, 15, 24, 28, 28, 39, 47, 57, 61, 71, 82, 90], "b": [11, 26, 27, 41, 47, 49, 51, 54, 70, 77, 84, 85, 92], "m": 7, "n": 8}}, {"idx": 4, "outputs": 2, "inputs": {"a": [-92, -90, -90, -28, -16, -14, -14, -8, 42, 52, 62, 84], "b": [-98, -98, -58, -6, 14, 16, 18, 46, 52, 52, 52, 56], "m": 11, "n": 6}}, {"idx": 5, "outputs": 0, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "b": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "m": 35, "n": 33}}, {"idx": 6, "outputs": 0, "inputs": {"a": [6, 7, 7, 12, 15, 15, 21, 24, 26, 26, 28, 36, 38, 42, 46, 52, 55, 56, 59, 62, 63, 65, 65, 66, 68, 71, 73, 77, 77, 77, 77, 85, 87, 87, 88, 90, 93, 94, 98], "b": [1, 3, 4, 4, 6, 7, 8, 8, 15, 17, 18, 18, 20, 23, 23, 24, 25, 25, 26, 33, 39, 43, 46, 54, 59, 67, 69, 69, 69, 69, 76, 76, 81, 81, 85, 86, 86, 91, 95], "m": 30, "n": 20}}, {"idx": 7, "outputs": 0, "inputs": {"a": [-82, -68, -68, -60, -60, -38, -20, -16, 4, 18, 18, 22, 24, 30, 34, 44, 70, 78, 88, 90, 94], "b": [-74, -68, -64, -62, -60, -52, -50, -44, -36, -34, -32, -30, -20, -18, -14, -2, 18, 62, 62, 84, 98], "m": 16, "n": 12}}, {"idx": 8, "outputs": 0, "inputs": {"a": [0, 0, 1], "b": [0, 0, 1], "m": 2, "n": 1}}, {"idx": 9, "outputs": 0, "inputs": {"a": [2, 7, 7, 9, 14, 15, 16, 20, 21, 26, 35, 37, 40, 45, 46, 47, 53, 56, 58, 61, 62, 67, 70, 70, 71, 73, 81, 85, 85, 90, 94, 98, 99], "b": [1, 7, 14, 16, 18, 19, 24, 27, 28, 29, 29, 37, 41, 44, 45, 48, 49, 55, 64, 67, 67, 71, 72, 79, 80, 84, 86, 88, 88, 92, 94, 98, 99], "m": 20, "n": 25}}]
question_info.entry_cls_name: Solution