title: Check Array Contains Contiguous Integers Duplicates Allowed
signature: function checkArrayContainsContiguousIntegersDuplicatesAllowed($arr, $n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($arr, $n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($arr, $n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        array(2, 4, 19, 25, 65, 72, 75, 83, 90, 92), 8, 
        false));
      
      printf("TEST-1...%s\n",driver(
        array(46, 2, 28, -44, 74, -36, -8, 30, -96, 60, 52, -58, 16, -38, 78, 38, -28, 16, 26, -42, 48, 40, 6, 72), 14, 
        false));
      
      printf("TEST-2...%s\n",driver(
        array(0, 1, 1, 1), 2, 
        true));
      
      printf("TEST-3...%s\n",driver(
        array(50, 21, 9, 29, 86, 2, 82, 49, 34, 18, 77, 83, 44, 67, 85, 58, 15, 85, 22, 3, 39, 67, 42, 37, 6, 35, 18, 57, 41, 32, 39, 30, 41, 68, 84, 36, 64, 36), 23, 
        false));
      
      printf("TEST-4...%s\n",driver(
        array(-92, -82, -80, -78, -66, -66, -62, -58, -54, -52, -48, -30, -26, -22, -20, -20, -18, -14, -2, 12, 20, 24, 26, 26, 28, 28, 32, 36, 42, 48, 50, 52, 56, 64, 70, 72, 72, 80, 82, 84, 86, 92), 26, 
        false));
      
      printf("TEST-5...%s\n",driver(
        array(1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0), 43, 
        true));
      
      printf("TEST-6...%s\n",driver(
        array(18, 19, 21, 23, 30, 33, 38, 40, 45, 56, 63, 68, 93, 96), 8, 
        false));
      
      printf("TEST-7...%s\n",driver(
        array(20, -90, -42, 48, 18, -46, 82, -12, -88, 82, 62, 24, 20, 64, -68, -34, -38, 8, -54, -20, -92, 34, -90, 78, 18, 8, -6, 10, 98, -24, 72, -92, 76, -22, 12, -44, 2, 68, -72, 42, 34, 20, -48), 34, 
        false));
      
      printf("TEST-8...%s\n",driver(
        array(0, 0, 0, 0, 0, 1, 1, 1, 1), 8, 
        true));
      
      printf("TEST-9...%s\n",driver(
        array(81, 25, 50, 48, 35, 38, 49, 21, 47, 94, 94, 55, 23, 45, 92, 23, 93, 33, 64, 9, 90, 64, 81, 17, 2, 73, 8, 7, 35, 36, 72), 27, 
        false));
      
  }
  
  main();
  ?>
source_py: def check_array_contains_contiguous_integers_duplicates_allowed(arr, n):
      max1 = max(arr)
      min1 = min(arr)
      m = ((max1 - min1) + 1)
      if (m > n):
          return False
      visited = ([0] * m)
      for i in range(0, n):
          visited[(arr[i] - min1)] = True
      for i in range(0, m):
          if (visited[i] == False):
              return False
      return True
source_cpp: bool check_array_contains_contiguous_integers_duplicates_allowed(vector<int> arr, int n) {
    int max = * max_element(arr.begin(), arr.end());
    int min = * min_element(arr.begin(), arr.end());
    int m = max - min + 1;
    if ( m > n ) return false;
    bool visited [ m ];
    memset ( visited, false, sizeof ( visited ) );
    for ( int i = 0;
    i < n;
    i ++ ) visited [ arr [ i ] - min ] = true;
    for ( int i = 0;
    i < m;
    i ++ ) if ( visited [ i ] == false ) return false;
    return true;
  }