title: Check Array Contains Contiguous Integers Duplicates Allowed
signature: check_array_contains_contiguous_integers_duplicates_allowed <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(2L, 4L, 19L, 25L, 65L, 72L, 75L, 83L, 90L, 92L), 8L, 
          FALSE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(46L, 2L, 28L, -44L, 74L, -36L, -8L, 30L, -96L, 60L, 52L, -58L, 16L, -38L, 78L, 38L, -28L, 16L, 26L, -42L, 48L, 40L, 6L, 72L), 14L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 1L, 1L, 1L), 2L, 
          TRUE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(50L, 21L, 9L, 29L, 86L, 2L, 82L, 49L, 34L, 18L, 77L, 83L, 44L, 67L, 85L, 58L, 15L, 85L, 22L, 3L, 39L, 67L, 42L, 37L, 6L, 35L, 18L, 57L, 41L, 32L, 39L, 30L, 41L, 68L, 84L, 36L, 64L, 36L), 23L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -82L, -80L, -78L, -66L, -66L, -62L, -58L, -54L, -52L, -48L, -30L, -26L, -22L, -20L, -20L, -18L, -14L, -2L, 12L, 20L, 24L, 26L, 26L, 28L, 28L, 32L, 36L, 42L, 48L, 50L, 52L, 56L, 64L, 70L, 72L, 72L, 80L, 82L, 84L, 86L, 92L), 26L, 
          FALSE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L), 43L, 
          TRUE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(18L, 19L, 21L, 23L, 30L, 33L, 38L, 40L, 45L, 56L, 63L, 68L, 93L, 96L), 8L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(20L, -90L, -42L, 48L, 18L, -46L, 82L, -12L, -88L, 82L, 62L, 24L, 20L, 64L, -68L, -34L, -38L, 8L, -54L, -20L, -92L, 34L, -90L, 78L, 18L, 8L, -6L, 10L, 98L, -24L, 72L, -92L, 76L, -22L, 12L, -44L, 2L, 68L, -72L, 42L, 34L, 20L, -48L), 34L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L), 8L, 
          TRUE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(81L, 25L, 50L, 48L, 35L, 38L, 49L, 21L, 47L, 94L, 94L, 55L, 23L, 45L, 92L, 23L, 93L, 33L, 64L, 9L, 90L, 64L, 81L, 17L, 2L, 73L, 8L, 7L, 35L, 36L, 72L), 27L, 
          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;
  }