title: Remove Minimum Number Elements No Common Element Exist Array
signature: remove_minimum_number_elements_no_common_element_exist_array <- function(a, b, n, m) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, b, n, m, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b, n, m), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 7L, 10L, 12L, 12L, 24L, 29L, 38L, 45L, 51L, 53L, 54L, 59L, 68L, 72L, 73L, 85L, 86L, 88L, 92L, 92L, 95L), list(7L, 9L, 17L, 23L, 25L, 26L, 29L, 32L, 35L, 56L, 56L, 58L, 59L, 59L, 62L, 63L, 72L, 82L, 85L, 86L, 95L, 97L), 15L, 13L, 
          3L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-6L, 48L, -70L, 14L, -86L, 56L, 80L, -64L, 64L, -88L, -14L, 78L, 14L, -18L, 52L, 2L, 22L, 88L), list(-62L, -58L, 60L, -30L, 42L, 8L, 66L, -48L, -18L, 64L, -76L, -90L, -48L, -90L, -24L, 64L, -88L, -98L), 15L, 9L, 
          2L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 10L, 10L, 
          9L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(10L, 93L, 2L, 16L, 36L, 49L, 36L, 86L, 6L, 99L, 95L, 2L), list(99L, 28L, 7L, 21L, 62L, 89L, 82L, 41L, 43L, 77L, 8L, 14L), 6L, 10L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -96L, -80L, -64L, -42L, -30L, -6L, 10L, 62L, 66L, 82L), list(-62L, -50L, -42L, 24L, 44L, 46L, 52L, 54L, 60L, 72L, 72L), 9L, 6L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 0L, 1L, 1L), list(1L, 1L, 1L, 0L, 0L), 4L, 2L, 
          4L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(7L, 11L, 13L, 15L, 21L, 33L, 36L, 39L, 66L, 99L), list(23L, 36L, 42L, 44L, 62L, 65L, 70L, 78L, 82L, 89L), 9L, 9L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-40L), list(-98L), 0L, 0L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 31L, 26L, 
          24L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(79L, 91L, 31L, 16L, 28L, 45L, 37L, 43L, 73L, 73L, 76L, 28L, 71L, 60L, 64L, 60L, 99L, 36L, 47L, 38L, 65L, 34L, 22L, 94L, 84L, 51L, 72L, 45L, 71L, 2L), list(58L, 94L, 12L, 27L, 98L, 38L, 75L, 20L, 94L, 43L, 32L, 90L, 23L, 41L, 88L, 2L, 62L, 96L, 53L, 57L, 48L, 79L, 6L, 16L, 11L, 46L, 73L, 57L, 67L, 7L), 18L, 18L, 
          1L
      )))
  
  }
  
  main()
source_py: def remove_minimum_number_elements_no_common_element_exist_array(a, b, n, m):
      countA = dict()
      countB = dict()
      for i in range(n):
          countA[a[i]] = (countA.get(a[i], 0) + 1)
      for i in range(n):
          countB[b[i]] = (countB.get(b[i], 0) + 1)
      res = 0
      for x in countA:
          if (x in countB.keys()):
              res += min(countA[x], countB[x])
      return res
source_cpp: int remove_minimum_number_elements_no_common_element_exist_array(vector<int> a, vector<int> b, int n, int m) {
    unordered_map < int, int > countA, countB;
    for ( int i = 0;
    i < n;
    i ++ ) countA [ a [ i ] ] ++;
    for ( int i = 0;
    i < m;
    i ++ ) countB [ b [ i ] ] ++;
    int res = 0;
    for ( auto x : countA ) if ( countB . find ( x . first ) != countB . end ( ) ) res += min ( x . second, countB [ x . first ] );
    return res;
  }